Note that there are some explanatory texts on larger screens.

plurals
  1. POBoost ASIO will send fast and then very slow
    primarykey
    data
    text
    <p>The product I work on uses Boost ASIO (TCP) for network communication. During a test I noticed something very strange: ASIO would send at ~60MB/s for 13 seconds and then drop to ~300K/s for 9 seconds then it would then go back to ~60MB/s for 13 seconds; this would repeat for the entire transfer. I wrote a test application to see if I could reproduce this and to my surprise, I could.</p> <p>In my test app, after the client and server connect the code is very basic. Of note, blocking and non-blocking sockets produce the same results. Here is how the server receives data in a blocking situation:</p> <pre><code>while(true) { boost::system::error_code ec; serverSocket.read_some(boost::asio::buffer(serverBuffer, bufferLength), ec); } </code></pre> <p>The client does this:</p> <pre><code>while(true) boost::asio::write(clientSocket, boost::asio::buffer(clientBuffer, bufferLength) </code></pre> <p>If bufferLength is 4K, I see the problem, but if I push it up to 32K the transfer speed is fast (>120MB/s) and consistent.</p> <p>Can anyone shed some light on what may be happening? This is a Windows application running on Windows Server 2008.</p> <p>Edit: I did a Wireshark capture and there is sometimes a delay of > 150ms of the server sending an ACK. i.e. client sends the last bit of data [PSH,ACK]; server reponds 150ms later with an [ACK]. No other traffic in between.</p> <p>2nd Edit: I wrote a C# app that exhibits the same behavior. Client sends 4k packets with NetworkStream.Write, and server reads them with NetworkStream.Read. Any suggestions on where to go from here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload