iis maximum number of concurrent connections, queue length, maximum number of concurrent threads, the maximum number of worker processes
The maximum number of concurrent connections:
1, factors:
a. html website request, html pictures resources, resource html script in the other resources need to connect to download, and so on, any request for a resource that is a connection (connection response soon although some resource request)
b. If using the page frame (frame nested within the web page request), then a frame that is connected to a
c. If the pop-up page (a web page request nested inside of the window), then connected to a window
2. Set Position: -> "Advanced Settings" -> "Restrictions" -> "the maximum number of concurrent connections"
Queue Length
Set Location: Select in IIS application pool [], the application pool list, right you want to view, select the [Advanced Settings] in the context menu, the default queue length is 1000
IIS maximum number of concurrent worker threads.
1、
配置文件:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
2、修改参数: <processModel autoConfig="false" maxWorkerThreads="200" maxIoThreads="200" minWorkerThreads="100" />
MaxWorkerThreads参数和maxIoThreads参数隐式地乘以 Cpu 的数量。例如,如果您有两个处理器,是以下的最大工作线程数︰2*maxWorkerThreads
MinWorkerThreads= maxWorkerThreads/2
- 优化每个处理器限制对线程 ASP 属性的值(默认25,已修改成50)
a.在连接窗格中,选择 web 服务器,请单击以选中功能视图,然后双击ASP功能。
b.单击以展开限制属性下行为,单击处理器限制每个线程,输入所需的值线程每个处理器限制单击应用中操作窗格。
三者关系
- iis最大并发连接数,队列长度,最大并发工作线程数关系:
- 三者确定了最大并发数
- 当很多请求同时到来的时候,IIS会根据【最大并发连接数】来判断是否有多余的请求,多余的请求直接返回503,然后再根据【队列长度】来判断是否有多余的请求排不了队,排不了队的也直接返回503。所以,如何设置【最大并发连接数】和【队列长度】,实际上是有公式可以计算的:
最大并发连接数 = 队列长度 + IIS最大并发工作线程数
- 例子:如果1000个请求同时到来,【最大并发连接数】设置为100,只有100个请求会收到正常响应,剩余900个请求直接返回503(服务不可用)的错误,【队列长度】设置为40,那么60个请求会直接返回503服务不可用的错误(因为队列只有40个的长度,剩下的60个就无法排队了),
最大并发工作线程数为10,10个请求被正确处理,30的请求排队等待
最大工作进程数
- 将应用程序池配置成一个Web园(Web Garden)
2、设置:网站的所属应用程序池,“右击高级设置”->"进程模型"->"最大工作进程数",默认1,如果这个值大于 1,那么当有连接请求时会启动多个新的工作进程实例,可启动的最多进程数为您所指定的最大工作进程数,后续更多的请求将以循环的方式发送至工作进程,这个每个工作进程都能承担负载一些连接请求,当然是以消耗cpu等硬件做代价。
3、最大工作进程数的设置方法:(拷贝)按照每工作进程能承载30个并发的原则来确定应用程序池的最大工作进程数。同时要注意,每个工作进程大约会占用200M左右的系统内存,在设置最大工作进程数的时候,要主要最大工作进程数与200M的乘积不要超过系统最大可用内存数。一般情况下,建议按照每次增加5个工作进程数的方式对最大工作进程数进行调整,调整完后对网站观察一段时间,如依然无法满足要求,再继续增加5个工作进程数。
4、在此模式下,解决session共享的问题
a、启动ASP.NET 状态服务
b、配置回话状态