TCP Server Memory management: #Connections Vs. #Requests
- by Andrew
Given that, there is no theoretical limit to number of concurrent TCP connections a Windows 2008 server can handle. Only thing will happen is, with each connection there will be memory consumption in server. Unfortunately, memory is not unlimited (and I want to utilize only physical memory).
For example, lets say we've 2GB server memory. Now there are two extreme cases:
Case 1:
If we've allocated 64KB buffer for each connection (only to receive incoming request), then 32768 connections can consume all the 2GB of memory. This will not leave any memory to queue/process incoming requests from those connections.
Case 2:
On the other hand, lets say a single (or very few) connections continuously keeps sending request buffers (for example, video streaming from one connection to other) and server cannot process them within time, those buffers will get piled up in server and eventually will occupy most of the servers memory. And it will not leave any memory for new connection thereafter.
This is the real dilemma in server design bugging me badly for last many days.
If I can decide on max size of request buffer per connection and max number of requests to allow in queue per connection. Then, based on available server memory, it will then automatically set limit on max number of concurrent connections.
How to decide on these limits to achieve best performance and throughput? I am just looking for perfect utilization of server resources.
Are there any standard guidelines or empirical data available with someone who can share with me please.