By optimizing the configuration of the IIS7, adjusting the queue length of the IIS7 application pool, the number of requests and the number of TCPIP connections, the performance of the Web server is improved and the access to the web is smooth.
IIS7.5 is Microsoft's latest platform for IIS, and performance is significantly higher than before, but the default settings are not suitable for a large request. But we can adjust the IIS according to the actual need, make it better performance, support 100,000 requests at the same time.
The following scenarios, by optimizing the configuration of the IIS7, adjust the queue length of the IIS7 application pool, the number of requests, the number of TCPIP connections, and so on, so that the performance of the Web server can be improved to ensure Web Access smooth access.
Today, around 17 o'clock in the afternoon, blog blog site to appear this error message:
Error Summary:
HTTP Error 503.2-service Unavailable
The Serverruntime@appconcurrentrequestlimit setting is being exceeded.
Detailed Error Information:
Module IIS Web Core
Notification beginrequest
Handler Staticfile
Error Code 0x00000000
Due to the default configuration used previously, the server can handle up to 5,000 simultaneous requests, and this afternoon due to a situation caused by more than 5000 concurrent requests, resulting in the above error.
To avoid such errors, we adjusted the settings based on the relevant documentation to allow the server to support 100,000 concurrent requests from the setup.
The specific settings are as follows:
1. Adjust the IIS 7 application pool queue Length
Change from the original default of 1000 to 65535.
IIS Manager > ApplicationPools > Advanced Settings
Queue length:65535
2. Adjust the Appconcurrentrequestlimit settings for IIS 7
Change from the original default of 5000 to 100000.
C:\windows\system32\inetsrv\appcmd.exe Set config/section:serverruntime/appconcurrentrequestlimit:100000
You can view this setting in%systemroot%\system32\inetsrv\config\applicationhost.config:
<serverruntime appconcurrentrequestlimit= "100000"/>
3. Adjust the setting of Processmodel>requestqueuelimit in Machine.config
1, click Start, and then click Run.
2, in the "Run" dialog box, type Notepad%systemroot%\microsoft.net\framework64\v4.0.30319\config\machine.config, and then click OK. (Different. NET version path is not the same, you can choose what you currently want to set. NET version of config)
3. Find the ProcessModel element shown below: <processmodel autoconfig= "true"/>
4. Replace the ProcessModel element with the following values: <processmodel enable= "true" requestqueuelimit= "15000"/>
5, save and close the Machine.config file.
Change from the original default of 5000 to 100000.
<configuration>
<system.web>
<processmodel enable= "true" requestqueuelimit= "100000"/> Reference article: http://technet.microsoft.com/en-us/library/ dd425294 (office.13). aspx
4. Modify the registry and adjust the number of simultaneous TCPIP connections supported by IIS 7
Change from the original default of 5000 to 100000.
REG ADD hklm\system\currentcontrolset\services\http\parameters/v maxconnections/t reg_dword/d 100000
Can be viewed in the registry
5. Run command use settings to take effect
NET stop HTTP & net start HTTP & iisreset complete the above 4 settings, you can support 100,000 concurrent requests, the blog blog server has enabled the above settings.
Solution:
Step One: Adjust the IIS application pool queue length.
in the Application pool list, select the application pool you want to use for your site, changing the original queue length from 1000 to 65535. Of course, the queue length here you can set according to your own access user * 1.5来, for example: You have 2000 users, you can set to 3000 (3000=2000 user number *1.5), official reference
Set the following figure:
Step Two: Adjust the Appconcurrentrequestlimit value of IIS
Open cmd command, Run command: C:\Windows\System32\inetsrv\appcmd.exe set Config/section:serverruntime/appconcurrentrequestlimit : 100000
Step three: Modify the ASP.net request queue limit to adjust the processmodel>requestqueuelimit in the Machine.config
1, click Start, and then click Run.
2, in the "Run" dialog box, type Notepad%systemroot%\microsoft.net\framework64\v4.0.30319\config\machine.config, and then click OK. (Different. NET version path is not the same, you can choose what you currently want to set. NET version of config)
3. Find the ProcessModel element shown below: <processmodel autoconfig= "true"/>
4. Replace the ProcessModel element with the following values: <processmodel enable= "true" requestqueuelimit= "15000"/>
5, save and close the Machine.config file.
Step Four: Modify the registry to adjust the number of concurrent TCPIP connections that IIS supports
To run a command in the cmd command: REG add hklm\system\currentcontrolset\services\http\parameters/v maxconnections/t reg_dword/d 100000, of course, you can also manually go to the registry to modify
For the method to use with yourself, I put the above can be used to simple bat operation in a bat file inside. Save the following content as Do.bat file run it, you need to manually operate
#appConcurrentRequestLimit
C:\windows\system32\inetsrv\appcmd.exe Set config/section:serverruntime/ appconcurrentrequestlimit:100000
REG ADD hklm\system\currentcontrolset\services\http\parameters/v maxconnections/t reg_dword/d 100000
# too long
REG add hkey_local_machine\system\currentcontrolset\services\ http\parameters/v maxfieldlength/t reg_dword/d 32768
REG Add hkey_local_machine\system\currentcontrolset\ services\http\parameters/v maxrequestbytes/t reg_dword/d 32768
#更多的可以可以查看这篇文章, hand-operated can view this article
start "C:\ Program Files\Internet Explorer\iexplore.exe "http://www.jb51.net/article/36073.htm
Here are a few things to add to our knowledge:
Support for highly concurrent IIS Web server common settings
Applicable IIS version: IIS 7.0, IIS 7.5, IIS 8.0
Applicable versions of Windows: Windows Server 2008, Windows Server 2008 R2, Windows Server 2012
1, the application pool (application pool) settings:
general->queue length is set to 65535 (the maximum value supported by the queue Length)
process Model->idle time-out set to 0 (does not allow application pools to be reclaimed because no requests are made)
recycling->regular time interval set to 0 (disable application pool for periodic automatic recycling)
2. Net framework-related settings
A) in Machine.config
<processmodel autoconfig= "true"/>
To
<processmodel enable= "true" requestqueuelimit= "100000"/>
(This setting takes effect immediately after saving)
b) Open C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers\Default.browser and find <defaultbrowser id= " Wml "parentid=" "Default", Comment <capabilities> section, and then run aspnet_regbrowsers-i on the command line.
<defaultbrowser id= "Wml" parentid= "Default" >
<identification>
To solve the TEXT/VND.WAP.WML problem.
3, IIS applicationhost.config settings
To set the command:
C:\windows\system32\inetsrv\appcmd.exe Set config/section:serverruntime/appconcurrentrequestlimit:100000
To set the result:
<serverruntime appconcurrentrequestlimit= "100000"/>
(This setting takes effect immediately after saving)
4, the HTTP.sys setting
Registry Settings Command 1 (set the maximum number of connections to 100,000):
REG ADD hklm\system\currentcontrolset\services\http\parameters/v maxconnections/t reg_dword/d 100000
Registry Settings Command 2 (resolve bad request-request Too long problem):
REG ADD hkey_local_machine\system\currentcontrolset\services\http\parameters/v maxfieldlength/t reg_dword/d 32768
REG ADD hkey_local_machine\system\currentcontrolset\services\http\parameters/v maxrequestbytes/t reg_dword/d 32768
(You need to run net stop HTTP & net start HTTP & IISReset on the command line to make the settings effective)
5, for the load balancing scene settings
Add the following rule in the URL Rewrite module:
<rewrite>
<allowedServerVariables>
<add name= "remote_addr"/>
</ allowedservervariables>
<globalRules>
<rule name= "Http_x_forwarded_for-to-remote_addr" Enabled= "true" >
<match url= ". *"/>
<serverVariables>
<set name= "REMOTE_ADDR" value= " {http_x_forwarded_for} "/>
</serverVariables>
<action type=" None "/>
<conditions >
<add input= "{http_x_forwarded_for}" pattern= "^$" negate= "true"/>
</conditions>
</rule>
</globalRules>
</rewrite>
Related posts: request.userhostaddress Records IP address problems encountered after moving into Aliyun
Note: Adding this URL rewrite rule causes the IIS kernel-mode cache to not work, as described in Microsoft's Pit: URL rewriting can cause the IIS kernel-mode cache to not work.
6. Set Cache-control as Public
Add the following configuration to the web.config:
<configuration>
<system.webServer>
<staticContent>
<clientcache cachecontrolcustom= "public"/>
</staticContent>
</system.webServer>
</ Configuration>
7, ASP. NET Thread Settings
Add the following settings to the <processModel> of Machine.config:
<processmodel enable= "true" maxworkerthreads= "maxiothreads=" minworkerthreads= "a" miniothreads= "50"/ >