Interesting Blog Posts on High Performance Servers

There are some interesting blog posts by Rick Vicik over on the Windows Server Performance Team Blog. Most interesting for me is part three of the three part series on “Designing Applications for High Performance”. Whilst parts one and two cover some useful ideas they’re pretty general. Part three really digs into the implementation of I/O completion ports and how new API calls can help improve performance and reduce locking within the APIs themselves.

Updated 25th May 2023 to fix broken links

These two pieces of information were especially interesting to me: “While you don’t need an event in the Overlapped structure when using Completion Ports because the event is never waited on, if you leave it out, the event in the file handle will be set and that incurs extra locking.” - which looks like an easy win if all you need to do is call SetFileCompletionNotificationModes() with FILE_SKIP_SET_EVENT_ON_HANDLE on the socket when it’s associated with the completion port.

Likewise; “Even if the I/O completes in-line (and PENDING is not returned), the I/O completion event is set and a completion is queued to the port unless the SetFileCompletionNotificationModes option is used.” - will be worth profiling though the code changes are larger due to the fact that the completion would need to be handled in the code that called WSARecv() etc. and the fact that completions could now be handled on threads there weren’t in the I/O pool needs to be considered…

Something to investigate for version 6.2 of The Server Framework perhaps.