I have a slightly unusual situation where I'm needing to maintain CLIENT tcp connections to another server for thousands of mobile users on my servers (basically the mobile devices connect to my middle tier server when they are able to, which maintains a more stable connection to the 3rd party server for the mobile devices).
Anyways, I've developed my server application using Async Sockets (wrapped up in a SslStream), and have got 1000 client sessions running full time on it right now. I'm quite happy with the results so far as I'm seeing about 0-10% average cpu usage on a single core processor, and about 60mb of ram being used over time.
My question is, how do I scale this up so I can reach 100,000 or 200,000 or more client sessions being run on my server? Again, this is a bit untraditional, as my server isn't really acting like a server, since I'm worried about outgoing connections, not incoming.
I know that there's a registry setting MaxUserPort that needs to be changed to get beyond the default which seems to be 5000. However, there seems to be another hard limit of 65535, and I'm not too clear on where that limit resides. Is this a limit per network interface? Is it a global Windows limit? Is it a limit per process?
If it is a limit per network interface, can I add multiple network interfaces and bind client session sockets to each interface (eg: 65k on interface 1, 65k on interface 2, etc.)?
I'm also not too sure what, if any socket options or properties I should be setting to help things out. Right now I'm not using any socket options.
I'd really appreciate any thoughts on this subject, as clear advice has been pretty hard to come by on this subject. Thanks!