HOWTO: Maximize the Number of Concurrent Connections to IIS6
Question:
I'm considering building a realtime ASP.NET application on IIS6, that'll need to support about 3,000 simultaneous users on a server, each with a keep-alive HTTP connection for "server push."
The HTTP connection will need to stay open for the duration of the user's session, to allow updates to be pushed to the browser in near real time.
My question is, is this technically feasible on IIS6, particularly with the large number of connections? If it's possible, are there any special considerations to get it to work?
Thanks in advance.
Answer:
Yup, IIS6 can easily handle 3,000 concurrent keep-alive connections, assuming you:
- Have sufficient HW resources (like RAM) on the system
- Reconfigure the system (i.e. tweak any applicable limits)
- Run scalable user software that handles the user load (i.e. uses asynchronous IO, not necessarily multi-threaded, has appropriate caches, etc)
Windows Server 2003 and IIS6 come configured for security out of the box, whose goal frequently opposes performance/scalability. For example, ability for the system to hold 3,000 connections ties up valuable system resources and can be considered a "security threat" given the right context. Now, one may want to make the tradeoff for functionality... but last I checked, software is neither clairvoyant nor omniscient (well, neither are humans, but that is a separate tangent altogether ;-) )... so one may need to do some tuning.
In your situation, there are a couple of non-obvious limits:
MaxConnections (HTTP.SYS)
Controls the number of simultaneous HTTP connections (and hence limits number of simultaneous connections serviceable by IIS6).
- On Windows Server 2003 RTM x86, this comes out to around 8,700
- On Windows Server 2003 SP1, the limit has been removed
- On Windows Server 2003 SP1 x64, since NPP is bound by available memory, you can increase concurrent connections by merely adding more RAM. To give a sense of scope - I have seen 50K+ concurrent connections to IIS6 on WS03SP1 x64 with 4GB RAM
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
Type: DWORD
Value: Range from 0 to 2^32-1
MaxUserPort (TCPIP.SYS)
Controls the max port number that TCP can assign. Every unique client making a request to your web server will use up at least one of these ports on the server. Web applications on the server making outbound SQL or SMB connections also use up these ports on the server... so it highly affects the number of concurrent connections. For SMB tuning, read the de-facto IIS6 and UNC Whitepaper.
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Type: DWORD
Value: Range from 5000 to 65536
Conclusion
Incidentally, default value for both are above 3,000, so given sufficient HW resources like RAM and well written application software, IIS6 should just work for you out of the box without any tuning. :-)
//David
Comments
Anonymous
April 14, 2006
Is the ServerListenBacklog metabase property, which has a max of only 500 on IIS 6, relevant in this situation?Anonymous
April 14, 2006
Mac - Nope.
Queuing, Threads, and Concurrently do not describe the same concept...
//DavidAnonymous
April 14, 2006
This is great info, thank you!
Keep the good work with your blog.Anonymous
April 14, 2006
[JS/CSS] event:Selectors - the simplest way to hook
Javascript events to a CSS class [Via: Jon
Galloway...Anonymous
May 04, 2006
Hi, do you know why when I have 2 concurrent downloads from an IIS site, I can't initiate a 3rd one. I can't even browse to any other pages, until either one of the tw downloads is complete.
Thanks,
TomasAnonymous
May 05, 2006
Tomas - I presume you are browsing/downloading with Internet Explorer. If so, that is by-design - WinInet, the underlying socket layer used by Internet Explorer, places that limit. It has nothing to do with IIS.
//DavidAnonymous
May 10, 2006
(Quote)
do you know why when I have 2 concurrent downloads from an IIS site, I can't initiate a 3rd one.
(/Quote)
This is the By Design "Safe Neighbor" style standard which downloads from webbrowsers are asked to adhere to when downloading gfrom the same site. Internet Explorer adhears to this guidline but it can bue turned off, You can change this by hacking the registy and editing the max number of downloads per site or turnign it off. However some sites will ban you for downloading too many concurrent streams, so use with caution.
~QAnonymous
May 18, 2006
David,
Is there an equation so that you can figure out how many you can support according to hardware? For example if I have a W2K3 w/SP 1 (Connections limit removed) IIS 6 server with a PIII 1.4 and 1.25Gb of ram?
Thanks,
KeithAnonymous
June 08, 2006
The comment has been removedAnonymous
July 11, 2006
I want to increase no of simultaneous connection hanlded by IIS6 in windows XP SP2.How can I?Anonymous
July 11, 2006
Apurva - You cannot. XP is considered a Client OS and number of simultaneous connections are deliberately limited.
//DavidAnonymous
July 14, 2006
Does concurrent connections depend only on RAM Sizing or speed of CPU also plays an important role.. Is there any socket limit, which controls the conucurrent connection..How many sockets can be opened by a streaming server for this..Anonymous
July 14, 2006
Can I get the solution to my queries. TksAnonymous
July 20, 2006
I think you may be confused. MaxUserPort affects outbound connections only.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;196271
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)
Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.Anonymous
July 20, 2006
The comment has been removedAnonymous
August 03, 2006
David
This article is very helpful.
Are the limits of concurrent connections the same for IIS 5.0 with Windows 2000 then for IIS 6.0 with Windows 2003 SP1?
IngmarAnonymous
August 03, 2006
Ingmar - IIS5 and IIS6 are totally different architecturally, so this discussion dos not apply to IIS5.
We designed and built IIS6 to be way more scalable than IIS5. Try IIS6 on an x64 machine with plenty of RAM and see it fly...
//DavidAnonymous
August 04, 2006
Thanks David.
We currently have a web application (with read/write access to a MS SQL Server database) that runs on Windows 2000 Server with IIS5 and we want to know if the app would be able to support 5000 concurrent users.
Since the move to Windows 2003 would imply changes to the application, we would want to make sure that this is really necessary. As a first step we have done some research in the web to see if there are any experiences as far as growing concurrent users to 5000 with IIS5 but we really haven't found much.
What would recommend us to do?Anonymous
August 04, 2006
igroppe - I suggest that you first test your application to determine if it can support 5000 concurrent users. You need to do this because you need to know the methodology and have tools to measure this value. Otherwise, your requirement is useless since you cannot validate whether a given server configuration actually meets the requirement or not.
Words mean nothing when it comes to scalability or performance. Ability to measure the numbers yourself, in your own configuration, means everything.
I suggest against searching for experiences of users configuring IIS5 for 5000 concurrent users because you assume you trust those people's measurement metholodogy and that their usage pattern is comparable to your own. Then, there is the fact that Microsoft will measure but rarely publish such results - for good reasons.
Anyways... if you test and see that IIS5 can meet your requirement - great. You do not need to move to Windows Server 2003.
But if it cannot, then you have heard me say that we have validated IIS6 to meet that requirement with our own test application - but you still need to validate it yourself (Windows Server 2003 180 day evaluation is free) since performance ALWAYS depends on the specific hardware, software, and configuration.
Then, you can weigh the costs of either staying on IIS5 and figuring out how to tune/scale it, or move to IIS6.
//DavidAnonymous
August 06, 2006
Thank you very much David.Anonymous
October 11, 2006
Dave, how would you suggest me to test 5000 concurrent connections against my current application?Anonymous
June 02, 2007
Hello Dave, Found this post interesting. But, I was wondering about your recommendation to configure through the Registry, is that preferable over configuring this and other similar IIS6 settings in the metabase.lxml? Thx...Anonymous
August 01, 2007
Those are TCP/IP stack settings, not IIS 6 settings...Anonymous
August 06, 2007
Thomas H - Yes. Sometimes I wish that everyone just understand the entire Windows networking stack and not just myopic goals like "maximize concurrent connections handled by IIS6" and magically figure out which settings to tweak. I apologize if my satire is not evident. I did point out where in the stack that the setting comes from, but I wager that few people would care about that detail when they just want to do things like "maximize concurrent connections". //DavidAnonymous
September 25, 2007
Was glad to come across this article because it gives me some hope. We're building a simple IRC like application and I've been wondering how many connections it'd be able to handle. I'm wondering though if socket connections == http connections. We're running a socket server on port 6667. Was also wondering if I'm OK accepting all that traffic through a single port or if I should try to distribute it over several ports. ThanksAnonymous
November 28, 2007
Very nice, but for MaxConnections is not the only restriction for this scenario. IIS itself by default handles only 25 simultaneous connections. User would need increase the value of AspProcessorThreadMax parameter in C:WINDOWSsystem32inetsrvMetaBase.xml. Regards, Alex Pinsker http://alexpinsker.blogpsot.comAnonymous
June 28, 2008
In config page of application pool under IIS 6 , Maximum worker process can be set to 1, 2, .... Question is, when set as 1, is this a single thread system? And, When each client sends a request, an instance of web application started so two requests will start two instances, right? How maximum worker process setting 1 or 2 differ, in terms of number of application instances? email: johnqxu@yahoo.comAnonymous
June 28, 2008
Alex - AspProcessorThreadMax is ASP specific, not IIS specific. What each application platform like ASP, ASP.Net, PHP chooses to do on top of IIS is up to the application platform and obviously need to be tweaked. //DavidAnonymous
June 28, 2008
John - Maximum worker process has no connection with single thread system. Application instance has no connection with number of worker process. IIS is a multi-threaded, multi-process system, and it can be configured to whatever you describe. //DavidAnonymous
July 01, 2008
Hi David, Very useful info. I wanted to know if this simultaneous connection is affected by number of CAL (Client Access Licence). In otherwords do I need 3000 CALs for 3000 simultaneous connections on Windows Server?Anonymous
July 01, 2008
Kal - I am no legal expert on CAL behavior. I believe the correct answer depends on your negotiated license agreement. For example, simultaneous anonymous and authenticated connections are accounted differently for various agreements. There are no technical constraints from IIS perspective. //DavidAnonymous
August 07, 2008
My application running on Mainframe sends severals (1000/2000) http commands to II6 and sometimes the answer coming from webserver is TOO MANY OPEN FILES!! On unix, the solution consist to modify the parameter ULIMIT but which is the corrispondent parameter to be modified on Windows 2003 Server. Thanks a lot for your kind answer. Ciao, LinoAnonymous
August 09, 2008
Lino - ULIMIT controls limits. However, the error you get back is not about limits, so I do not think the two are corresponding. Windows has corresponding limit controls, but I doubt they are involved here. You will have to give more information about how many HTTP requests in what time-span, to what resources, and how those resources are configured to be handled. For example, are you retrieving files from UNC Virtual Directory, or executing server-side ISAPI application, etc. Thousands of simultaneous HTTP requests is no problem for IIS6, but depending on what you are doing, the server-side application or configuration may not be able to handle it. //DavidAnonymous
August 12, 2008
David Given that XP64 and 2K3 have the same base code will those tweaks work for XP64? Thx. NickAnonymous
August 13, 2008
Nick - XP64 is not server SKU and thus will have a TCP-level concurrent connection limit. //DavidAnonymous
October 30, 2008
Hi David I wonder if there is a limit on the maximum users reading and writing on to remote storage spce allocated by an IIS-FTP server running on a W2008/ 2003 server? What are the performance bottlenecks one is likely to face?Anonymous
October 31, 2008
Rao - I recommend reading the following documentation to understand the relationship between users and remote storage as well as how to properly provision the server. http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a9c8864a-8e61-4d28-a3ab-2427b6622845.mspx?mfr=true //DavidAnonymous
December 30, 2008
Hi, Is it possible to retrieve the concurrent user connections in the server now...Anonymous
January 12, 2009
The comment has been removedAnonymous
January 13, 2009
Ronen - Outbound requests have nothing to do with IIS at all... There are no such limitations in Windows to outbound connections. You will have to look at your application code and explain what it is doing that limits its scalability. It is very easy to write unrealistic prototype code that does not scale properly. For example, rapidly opening/closing connections will quickly exhaust server-side ports and limit outbound connections by causing failure. //DavidAnonymous
January 29, 2009
Hi If I use my windows XP system as server for howmany clients I can server with iis?Anonymous
February 10, 2009
Hi David, I have gone thro' the blog which is quite interesting and useful. I have a VBA application which fetches data from Oracle and processes some complicated business logic and gives the output in a excel sheet(With so many graphs and sheets). Now my requirement is to convert the VBA application into .NET web application. Now my client is asking me, how many concurrent users the application would be able to handle. I searched the web and i couldn't found any answers for this. I understand that it all depends on the H/W, memory, etc, but i need to give him a clear explanation. Could you please help me out in this task.Anonymous
February 18, 2009
Raaj - You need to first ask your client how many concurrent users are required. The real answer is "it depends" -- the web application can scale from 1 to unlimited number of concurrent users. Too many dependencies to explain. I doubt you will ever find answers to performance questions by searching the web because many people get paid a lot of money for such skills and information. If the client cannot set expectations (that are reasonable), then attempting to give a clear explanation will not be useful, either. //DavidAnonymous
February 19, 2009
I need help. I am testing IIS to setup the max connection and I see somthing werid happened. Can you explain this? This is the senerio: I set the max connection to 2. I open 2 browsers to the webiste. They both work ok. The 3rd browser to the website gets the "Service Unavailable" as expected. I didn't touch any of the browser for about 2 mins. When I refresh the 3rd browser, it now gets the website ok. However, one of the first two is kicked out. I set the connection timeout to 600. What is happening here? I thought when the user reachs the max connection, he can not go to the website until others have closed connection. What can I do? I don't want the users being kicked out. Please help.Anonymous
February 19, 2009
David, What if IIS 6.0 is running on a virtual server (VMware). Given that it has enough resources, would the numbers you specify still valid?Anonymous
February 24, 2009
hi, I know this isn't the place for it.. but assuming the concurrent connections to be the topic here.. how can I get or know if user has many concurrent connections simultaneously, using ISAPI..? thanksAnonymous
March 03, 2009
that's very good for me and this link will help me. so thank u very muchAnonymous
March 24, 2009
Hi, we have a web application hosted, which is taking longer time sometimes when numbner of users are increasing or when the number of page request shots up it's just hanging... Pls help it's veru veru crucial......asapAnonymous
April 07, 2009
Hi, we have ten client access licenses for SQL Server 2005 standard. My question is does this limit us to 10 concurrent connections? Or does it just limit us to 10 installations (on 10 different machines)? Thank you for any information.Anonymous
April 20, 2009
I have multiple virtual directories in my IIS 6. I want to configure max connections separately for each of them (ranging between 20-200). Is it possible to do? I am using Windows 2003 Advanced Server. Thanks in advance.Anonymous
April 20, 2009
Matt H. - You need to clarify the type of CAL you purchased. I found the following URL explaining the types of CAL for SQL Server 2005. http://www.microsoft.com/sqlserver/2005/en/us/licensing.aspx The URL explains the licensing types very well, as well as the situations which benefit each licensing type. //DavidAnonymous
April 23, 2009
Hi David.... I would like to know the maximum number of connections possible <b>from the same IP</b> to an application running on IIS 6. Is there a limit put in by Microsoft. If there is, do can I remove that ? I am asking this because a large number (over 1000) people access the application from the same organization and to IIS they appear to come from the same IP. Thanks in advance!!Anonymous
April 23, 2009
Editing my previous question... All the users access the application concurrently.. ThanksAnonymous
June 30, 2009
But what about the maxWorkerThread in machine.config as I see it, this is a limit of 20 that can not be set higher than 100. I would need to have several open connection to aspx pages, but i dont know how i can set up a system so that i can have more than 100 ? I would need about 1000 - 2000 open connection. Is this posible using aspx or do i need to answer from sockets ? I happy if someone can help or add some information.Anonymous
July 15, 2009
Hi, i would like to know how many concurrent connection IIS 7 on windows server 2008 can handle ? actually i have an asp.net application to be used for atleast 30,000 concurrent users plz helpAnonymous
September 16, 2009
Thank you for the information, it is very worthy for me :)Anonymous
November 15, 2009
We have a .NET restful web-service returning stream out of ~5mb file. We have to support 5000 concurrent download, and the restful web service is hosted at: Win2003 32 bit processor 2GB RAM IIS 6 The average response time of service is .025 sec. Please let know how much server we would need to NLB to meet our concurrent thread limit. Thank youAnonymous
July 28, 2010
Does this article apply to Windows Server 2008 and other OSes like Window XP, Windows 7, Vista, etc. that host IIS 5.1-7?Anonymous
September 02, 2010
Can we change any of the IIS parameters like max client runtime without re-starting the sever?Anonymous
March 22, 2012
If I have Windows authentication enabled in Windows 2003 IIS and want users to be logged in only one time, i.e. a users cannot use his/her login on more than one computers simultaniously, what should I do?