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

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

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

找到Web站點(diǎn)對應(yīng)的應(yīng)用程序池,“應(yīng)用程序池” → 找到對應(yīng)的“應(yīng)用程序池” → 右鍵“高級設(shè)置...”

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

1、基本設(shè)置

[1] 隊(duì)列長度: 默認(rèn)值1000,將原來的隊(duì)列長度改為 65535。

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

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

2、高級設(shè)置

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

[2] 快速故障防護(hù) → 已啟用 :默認(rèn)True,改為False。 

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

回收間隔時(shí)間

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

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

二、支持同時(shí)10萬個(gè)請求

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

站點(diǎn)碰到如下問題:

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

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

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

具體設(shè)置如下:

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

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

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

由原來的默認(rèn)5000改為100000。

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

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

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

<serverRuntime appConcurrentRequestLimit="100000" />

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

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

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

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

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

[5] 保存并關(guān)閉 Machine.config 文件。

由原來的默認(rèn)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支持的同時(shí)TCPIP連接數(shù)

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

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

或者直接在注冊表中找到這個(gè)項(xiàng)目修改。

5. 運(yùn)行命令使用設(shè)置生效

net stop http  & net start  http & iisreset

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

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

#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服務(wù)器常用設(shè)置   

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

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

1、應(yīng)用程序池(Application Pool)的設(shè)置:

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

2、.Net Framework相關(guān)設(shè)置

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

改為

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

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

[2] 打開C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\Browsers\Default.browser,找到<defaultBrowser id="Wml" parentID="Default" >,注釋<capabilities>部分,然后在命令行中運(yùn)行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設(shè)置

設(shè)置命令:

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

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

4、http.sys的設(shè)置

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

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

注冊表設(shè)置命令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

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

5、針對負(fù)載均衡場景的設(shè)置

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

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

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

6、設(shè)置Cache-Control為public

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

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

7、ASP.NET線程設(shè)置

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

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

相關(guān)文章

最新評論