让Windows Server 2008 + IIS 7+ ASP.NET 支持10万并发请求

原文:http://www.cnblogs.com/dudu/archive/2009/11/10/1600062.htmlphp

 

今天下午17点左右,博客园博客站点出现这样的错误信息:html

Error Summary:web

HTTP Error 503.2 - Service Unavailable
The serverRuntime@appConcurrentRequestLimit setting is being exceeded. windows

Detailed Error Information:服务器

Module IIS Web Core 
Notification BeginRequest 
Handler StaticFile 并发

Error Code 0x00000000app

因为以前使用的是默认配置,服务器最多只能处理5000个同时请求,今天下午因为某种状况形成同时请求超过5000,从而出现了上面的错误。async

为了不这样的错误,咱们根据相关文档调整了设置,让服务器从设置上支持10万个并发请求。code

具体设置以下:orm

1. 调整IIS 7应用程序池队列长度

由原来的默认1000改成65535。

IIS Manager > ApplicationPools > Advanced Settings

Queue Length : 65535

2.  调整IIS 7的appConcurrentRequestLimit设置

由原来的默认5000改成100000。

c:\windows\system32\inetsrv\appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000

在%systemroot%\System32\inetsrv\config\applicationHost.config中能够查看到该设置:

<serverRuntime appConcurrentRequestLimit="100000" /> 

3. 调整machine.config中的processModel>requestQueueLimit的设置

(Machine Config文件的默认位置是%windir%\Microsoft.NET\Framework\framework_version\CONFIG.)

(如:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config)

由原来的默认5000改成100000。

<configuration>
    <system.web>
        <processModel enable="true" requestQueueLimit="100000"/>

参考文章:http://technet.microsoft.com/en-us/library/dd425294(office.13).aspx

4. 修改注册表,调整IIS 7支持的同时TCPIP链接数

由原来的默认5000改成100000。

reg add HKLM\System\CurrentControlSet\Services\HTTP\Parameters /v MaxConnections /t REG_DWORD /d 100000 

5. 运行命令使用设置生效 

net stop http  & net start  http & iisreset 

完成上述4个设置,就能够支持10万个并发请求,博客园博客服务器已经启用上述设置。 

参考文章:

IIS 7.0 503 errors with generic handler (.ashx) implementing IHttpAsyncHandler

Tuning Windows Server 2008 for PHP 

相关文章
相关标签/搜索