I'm doing a Boost asio networking program for Mac OS X based on the HTTP Server 3 example. It uses async_read_some to read data from the TCP socket asynchronously.
The problem is that my handler returns with a very small amount of data. I give it a 64k buffer but it usually returns with about 1448 bytes which is the size of one full Ethernet packet. This in turn causes high CPU usage when there is a large data transfer and I can't imagine all those kernel to user space jumps are efficient.
Is this normal to get data in such small chunks?
Is there a way to tell the TCP stack or the asio framework to try and buffer more data in the kernel before returning?