Restarted work on the isapi_reward ISAPI filter/extension mentioned earlier.

The trick seems to be to handle outgoing connections (for forwarded requests) in an efficient and scalable manner. Started out using non-blocking sockets and events, but the WaitForMultipleEvents() call puts a hard upper limit of 64 on the number of active sockets. While it is rather unlikely that many sites would need that many back-end connections, I was not happy with the hard limit.

Turns out I had mostly forgotten about IO completion ports on Win32, as I had never had an application that called for their use before. Using IO completion ports removes the hard limit - though I have to wonder if Windows has limits on the number of associated handles (sockets).

Was a bit stumped at first about how to do the initial connect() or WSAConnect() as there was no mention of behavior when used with IO completion ports - then found a reference to ConnectEx(). which performs overlapped connections using completion ports - but only works on Windows XP and later. Guess that answers the question.

Since I’d like to support Windows 2000, looks like I will need separate thread(s) to perform blocking connect() calls. Likely this is not an issue, as the number and rate of connect() calls should not be an issue in expected usage. Might even be a good means to limit the connection rate when a back-end server is misbehaving.

One more re-write…