boost::asio async performance

2019-04-11 13:02发布

I've developed a TCP network application using boost::asio with an asynchronous approach. The application sends around 1GB of data in the following way:

  • Send a 5 bytes command (using async_write())
  • Send a 1024 bytes data (using another async_write())
  • Repeat until all the 1GB data is sent

When I use a synchronous approach the performances are the expected (around 9 seconds to TX 1GB of data using a 1Gb ethernet) but when I use asynchronous calls the performance decrease and 20 seconds are needed to TX the same amount of data.

I have tried to deactivate the Nagle's algorithm but it doesn't solve the problem.

do you know if using several async_write() calls with small amounts of data can have a negative impact on performances?

Thanks!

0条回答
登录 后发表回答