Windows temporarily shuts down my TCP stack when I stress test my HTTP server
I'm building an HTTP server for Windows that uses IO Completion ports (IOCP). I have a stress test app that hits the server continuously with HTTP requests. After a couple seconds (a varying, unpredictable interval), my machine is unable to open any new TCP connections. I know this because my browser is unable to open any new connections, and the server just waits for an AcceptEx call to complete. If I cool off the stress process, then everything comes back to life again after a few seconds. I don't think it's a backlog issue because the stresser is synchronous - it waits for a result before issuing the next req开发者_开发技巧uest. The stresser does run a couple (call it N) threads in parallel, but that can't cause more than a backlog of N (small HTTP) requests.
I'm on Windows 7 Pro. Will test on a Windows Server OS on Monday. What is causing this behaviour?
Are you running out of TCP ports due to a very large number of them staying in the TIMED_WAIT state?
Google Windows ephemeral ports.
精彩评论