Link to home
Create AccountLog in
Avatar of milan_novkovic
milan_novkovicFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Max number of simultaneous connections

Hi guys,
What is the maximum number of simultaneous TCP/IP connections in Windows 2003 Server and which factors can reduce that number.

Thanks
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Given your question history, I'm guessing it's not, but this sounds a lot like a homework question.

Maximum number is roughly 4 billion.  Factors that can affect it include bandwidth, CPU, RAM, what the connections are doing (Ping responses, serving web pages, ftp, mail, etc).
Avatar of milan_novkovic

ASKER

We have a problem with our service which is ISAPI extension written in C++. It seems that when amount of traffic reaches certain point there’s no more connections available to our server, so we have to either physically reboot server or restart IIS with limited number of simultaneous connections.
I forgot to tell you that our service is serving POS terminals. Main server is communicating with several other servers (some of them are in LAN, some of them are connected through VPN). When I do netstat -an usually there are around 500 connections (most of them for communication with terminals), but sometimes it reaches over 1000 connections, and by that point we seem to have problems with number of connections.
Do you actually get an error?

You say "restart IIS with limited number of simultaneous connections"...are you limiting the # of connections inside IIS?
Did you install this update?
http://www.microsoft.com/technet/security/bulletin/MS05-019.mspx
There is a fix that is described in KB898060.

Good luck,

Walter
My IIS gets locked up after about 700-800 connections.
Some are in established state (most of them) as I have thousands of clients from the web, while others are in all other states, mostly waiting for possibly delayed packets (TIME_WAIT). When I cut time wait from default 4 minutes to 30 seconds and increase maximum port number from 5000 to what evet the maximum is situation gets better but only for a while.

My IIS is in unlimited connections state. Why does it lock up? Is there a maximum number of TCP/IP connections per process? (With IIS I have ISAPI extenisons running in dllhosts.

Connections are from the web but CPU handles all the load with 4% (as it routes requests to other servers), and I have 2 Gig of memory to spare.

Sudden rush of connections is the most critical (e.g. as I restart the IIS).
If I instruct the server to limit connections to 50 (to start with) and then keep manulay extending this number server comes up nicely.

From IIS I go out to 3 other servers using. Two are local (the same machine but different dll hosts) and use http while the third one is remote https.

After startup the incidence of events (and so creation of new tcp/ip) is from 05. - 1.5 /sec but before of net hickups and OS in general these tend to cluster in groups of 2-5, mostly. but fometimes over 10.

Can my problem be because extensions under the same IIS (albeit isolated in diffrent dllhosts) are calling each other (there are no circular dependencies)

I use IIS6 but running in IIs5 mode
I am still Win2003 SP1. Had a look at Cisco logs and found no trace of DoS attacs. But would install SP2 and this patch.
One sys support guys says that in practice there is a low limit to overall tcp/ip pool on win 2003.
It was resource related he says. I'll read and understand tomorrow as it's late now.
I did, however, tried the following 4:

TcpTimedWaitDelay=30
MaxUserPort = 65534
MaxHashTableSize = 65536
MaxFreeTcbs = 16000
After reading and trying tools from sysinternals web site I don't now think this is a handle issue (sockets, files, threads individualy or any combination of the three).

TCP/IP question at the begining was missplaced: IIS can have "unlimited" connections, as they say but it is ultimately limited (my incomplete research) by non-swappable kernel memory as some TCP/IP structures go there. My understanding is that this part of the memory is limited to 128/256 Mb, depending on the OS, but is not only for TCP/IP but for many components of the OS. I have enough resources here at the time I start experiencing problems.

However, having said "threads" I mean it is not my ISAPI having problems with them.

But I made serious mistake by executing some lightwaitht commands in IIS I/O thread pool instead in my own worker pool.

IIS lmits I/O thread pool to 256 threads (I believe this is a hard limit on IIS5, not sure about IIS6).

I'll fix this but it would stil be good to know why IIS cannot recover from this (if this now proves to be the problem)
I learned what was going on and fixed. To help others here it is, 2 things that were wrong:

- For a good reason at the time I was executing requests in IIS's I/O threads. However, that is quite wrong in bussy systems as there is hard limit of 256 of these threads (not quite sure about the number but close to this figure). After empoying all of these IIS gets suck until some are released. I thought, wrongly, it was the number of TCP/IP connections. Now I release these threads rapidly and shift the work to my worker threads.

- I was using my ISAPI extension as WinInet client of a few other servers as well. However, WinInet limits the number of concurent connections, over WinInet, to other servers as:
     - 2 to the same http 1.1 server
     - 4 to the same http 1.0 server
   So, plenty of scope to get stuck here so I increased to reasonable numbers, appropriate to my app.

Thanks for your help and best wishes
Milan
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer