What is the maximum number of TCP connections I can have in Windows Server 2008?

You can go well beyond 65k connections; as you can have multiple connections per port (once accepted, the listener can connect to another client). One end or the other does have to have some difference, usually the client picks a random port. Windows is by default limited to a few more than 3000 of these random ports; so your typical client will max out around that. It's possible to configure the client differently however, and many *nix are limited to many more than Windows.

There's a registry setting limiting the maximum number of connections to 16 million. But there are other more practical problems that will usually limit you to less (you can change the registry value).

  • Windows takes up about 1KB of RAM per connection (That's ~16GB for 16M connections); and your app will also have to keep track of it's active connections somehow (more memory).
  • Windows will also check for non-responsive connections ever 2 hours. At 16M connections this is about every 0.5 ms; it would take up significant bandwidth just doing those checks.