Improve async performance #164
I have a (non-public) test case that executes two bulk read queries (in a batch); one that returns 31K rows of
On full .NET 4.6.2 on Windows 10, the sync codepath uses less than one core and completes in 4s; the async code path uses over 300% CPU and takes 20s wall time.
With dotnet, the results are even worse:
Some investigation with dotTrace and dotPeek on the full .NET Framework shows that
Additionally, network bandwidth (shown in Task Manager) is noticeably lower for the async case than the sync case.
We may need to find some way to get the benefits of asynchronous I/O without the overhead of
The text was updated successfully, but these errors were encountered:
I've done some more thinking on this issue, and I don't think that the issue is necessarily .NET anymore. Look at how many times we are calling into the OS Network Buffer in
The entire result set is delivered in a single TCP Packet (select-10-blog-posts-pcap.zip), but we read it from the OS Socket Buffer column by column. I believe that every call to Read here is a syscall into Kernel Space to fetch the bytes.
The solution implemented uses a Synchronous syscall to read the socket if the data is ready, instead of an Async syscall that would have to wait for an interrupt before the data was delivered.
I think that the right solution would be to attempt to buffer all of