欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

IIS7.0/IIS7.5/IIS8.0中應用程序池最優(yōu)配置方案

 更新時間:2023年10月25日 10:10:42   投稿:mdxy-dxy  
這篇文章主要介紹了IIS7.0/IIS7.5/IIS8.0中應用程序池最優(yōu)配置方案,需要的朋友可以參考下

找到Web站點對應的應用程序池,“應用程序池” → 找到對應的“應用程序池” → 右鍵“高級設置...”

一、一般優(yōu)化方案

1、基本設置

[1] 隊列長度: 默認值1000,將原來的隊列長度改為 65535。

[2] 啟動32位應用程序:默認值False,改為True, 否則安裝一些32的組建或32位的php都會出錯。

[3] 托管管道模式:Integrated 或 Classsic(集成/經(jīng)典)。 

2、高級設置

[1] 閑置超時(分鐘):默認20分鐘,修改設長。

[2] 快速故障防護 → 已啟用 :默認True,改為False。 

3、解決PEP第一次打開PEP速度慢

回收間隔時間

使用windows server 2008 r2解決回收假死的問題

打開應用程序池 -> 高級設置 ->在“禁止重疊回收”里選擇“true”,這樣就有效避免了應用程序池回收假死問題。

二、支持同時10萬個請求

通過對IIS7的配置進行優(yōu)化,調(diào)整IIS7應用池的隊列長度,請求數(shù)限制,TCPIP連接數(shù)等方面,從而使WEB服務器的性能得以提升,保證WEB訪問的訪問流暢。

站點碰到如下問題:

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

由于之前使用的是默認配置,服務器最多只能處理5000個同時請求,今天下午由于某種情況造成同時請求超過5000,從而出現(xiàn)了上面的錯誤。

為了避免這樣的錯誤,我們根據(jù)相關文檔調(diào)整了設置,讓服務器從設置上支持10萬個并發(fā)請求。

具體設置如下:

1. 調(diào)整IIS 7應用程序池隊列長度

將原來的隊列長度由默認值 1000 改為 65535。當然這里的隊列長度你可以根據(jù)自己的 訪問用戶*1.5 來設置,例如:有2000用戶,此處就可以設置為3000(3000=2000用戶數(shù)*1.5)。

2.  調(diào)整IIS 7的appConcurrentRequestLimit設置

由原來的默認5000改為100000。

[1] 在cmd中執(zhí)行:

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

[2] 在%systemroot%\System32\inetsrv\config\applicationHost.config中可以查看到該設置:

<serverRuntime appConcurrentRequestLimit="100000" />

3. 調(diào)整machine.config中的processModel>requestQueueLimit的設置

[1] 單擊“開始”,然后單擊“運行”,或者 windows + R。

[2] 在“運行”對話框中,鍵入 notepad %systemroot%\Microsoft.Net\Framework64\v4.0.30319\CONFIG\machine.config,然后單擊“確定”。(不同的.NET版本路徑不一樣,可以選擇你自己當前想設置的.NET版本的config)

[3] 找到如下所示的 processModel 元素:<processModel autoConfig="true" />

[4] 將 processModel 元素替換為以下值:<processModel enable="true" requestQueueLimit="15000" />

[5] 保存并關閉 Machine.config 文件。

由原來的默認5000改為100000。

<configuration>

<system.web>

<processModel enable="true" requestQueueLimit="100000"/>

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

4. 修改注冊表,調(diào)整IIS 7支持的同時TCPIP連接數(shù)

由原來的默認5000改為100000,在cmd中執(zhí)行:

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

或者直接在注冊表中找到這個項目修改。

5. 運行命令使用設置生效

net stop http  & net start  http & iisreset

完成上述5個設置,就可以支持10萬個并發(fā)請求。

為了方法大家與自己使用,我把上面能用bat操作簡單放到一個bat文件里面了。將下面的內(nèi)容保存為do.bat文件運行就可以了,需要手工的自己操作

#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

#更多的可以可以查看這篇文章,手工操作的可以查看這篇文章
start "C:\Program Files\Internet Explorer\iexplore.exe" http://www.dbjr.com.cn/article/36073.htm

三、支持高并發(fā)的IIS Web服務器常用設置   

適用的IIS版本:IIS 7.0, IIS 7.5, IIS 8.0

適用的Windows Server版本:Windows Server 2008, Windows Server 2008 R2, Windows Server 2012

1、應用程序池(Application Pool)的設置:

[1] General->Queue Length設置為65535(隊列長度所支持的最大值)
  [2] Process Model->Idle Time-out設置為0(不讓應用程序池因為沒有請求而回收)
  [3] Recycling->Regular Time Interval設置為0(禁用應用程序池定期自動回收)

2、.Net Framework相關設置

[1] 在machine.config中將
  < processModel autoConfig="true" />

改為

<processModel enable="true" requestQueueLimit="100000"/>

(保存后該設置立即生效)

[2] 打開C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers\Default.browser,找到<defaultBrowser id="Wml" parentID="Default" >,注釋<capabilities>部分,然后在命令行中運行aspnet_regbrowsers -i。以解決text/vnd.wap.wml問題。

<defaultBrowser id="Wml" parentID="Default" >  <identification>   <header name="Accept" match="text/vnd\.wap\.wml│text/hdml" />   <header name="Accept" nonMatch="application/xhtml\+xml; profile│application/vnd\.wap\.xhtml\+xml" />  </identification> <!--  <capabilities>   <capability name="preferredRenderingMime"    value="text/vnd.wap.wml" />   <capability name="preferredRenderingType"    value="wml11" />  </capabilities> --> </defaultBrowser>

3、IIS的applicationHost.config設置

設置命令:

c:\windows\system32\inetsrv\appcmd.exe set config /section:serverRuntime /appConcurrentRequestLimit:100000
  設置結(jié)果:
  < serverRuntime appConcurrentRequestLimit="100000" />

(保存后該設置立即生效)

4、http.sys的設置

注冊表設置命令1(將最大連接數(shù)設置為10萬):

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

注冊表設置命令2(解決Bad Request - Request 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

(需要在命令行運行 net stop http  & net start http & iisreset 使設置生效)

5、針對負載均衡場景的設置

在Url Rewrite Module中增加如下的規(guī)則:

<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>

相關博文:遷入阿里云后遇到的Request.UserHostAddress記錄IP地址問題

注意事項:添加該URL重寫規(guī)則會造成IIS內(nèi)核模式緩存不工作,詳見微軟的坑:Url重寫竟然會引起IIS內(nèi)核模式緩存不工作。

6、設置Cache-Control為public

在web.config中添加如下配置:

<configuration>  <system.webServer>   <staticContent>    <clientCache cacheControlCustom="public" />   </staticContent>  </system.webServer> </configuration>

7、ASP.NET線程設置

在machine.config的<processModel>中添加如下設置:

< processModel enable="true" maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50" minIoThreads="50"/>

相關文章

最新評論