I have a C# TCP Asynchronous socket server.
Testing locally, I can accept 5K connections over 35 seconds. I am running a quad core hyper threaded PC (8 threads) and the utilization is ~20-40% on each core. As the connections are accepted, the server asks the client for a bunch of data and then performas a bunch of database entries.
I moved the server application and SQL database to a small database and medium server instance on Amazon AWS.
The Amazon Medium server(EC2) is 1 virtual core and 2 ECU’s. From what I can tell it only has 1 thread.(from performance monitor)
If I try to connect 1000 clients over 35 seconds to the medium server. After ~650 connections i start to receive Connect failed(b) No connection could be made because the target machine actively refused it.
Looking at performance monitor, I noticed that the CPU utilization is only ~10-15%.
I am guessing that the core is not getting loaded because it is trying to handle a huge queue of connections, of small operations and does not provide enough load to increase CPU usage, since the server only has 1 virtual core.
Does anyone have any experience with this, does my theory make sense? I am stuck at a hardware limitation? (need to bump up the server size?)
If not, any ideas how to get more utilization and support more/quicker connections?
Does anyone have experience with this?
EDIT:
I upgraded my instance on Amazon EC2 to the High CPU Extra Large instance.
The Instance now has 8 cores and 20 ECU’s.
I am experiencing the same problem, I get No connection could be made because the target machine actively refused it after ~600 connections.
I was able to fix this issue. I upgraded my Instance to use PIOPS. I also used a better internet connection locally, as my old upload rate was too slow to support sending all the data and connections.
With these 2 changes I am able to create 5K+ TCP connections locally and connect to the server no problem.