I'm using boost-beast connection on macOS application to download a file.. in some rare cases I see bad TCP performance. Packet trace investigation revealed that the TCP sliding window is very small (2688 bytes), about 2 packets, and I believe this cause the slowness, since if I use curl the window is much bigger (about 4MBytes).
I check the connection using nettop
and saw different congestion method in each of the cases. Boost-beast connection used ledbat
congestion whereas curl used cubic
method.
I wonder if it can explain the difference in window size. Perhaps there's a way to set the congestion control method when opening boost-beast https connection ?
If we can obtain the underlying native socket from the connection, we can surely set this by using setsockopt. This however, give socket object and not the native one.
boost::beast::get_lowest_layer(stream_).socket()
Perhaps anyone can show me how to extract the socket and change its attributes using setsockopt ?