设为首页 收藏本站
查看: 680|回复: 0

[经验分享] 修改machine.Config 提高iis性能

[复制链接]

尚未签到

发表于 2015-8-16 08:44:36 | 显示全部楼层 |阅读模式
Tuning IIS - machine.config settings
  Recently I needed to try and reduce contention within IIS when calling a number of web services. Eventually this led to the need to make some changes to the machine.config file.
  The changes identified were based on the Microsoft recommended settings. These recommended values should be viewed as a start point for continued tuning, but have been shown to work in most circumstances. They are based on the premise that for each ASPX page in use you are making one Web service call to a single IP address.
  It is only suggested that you try this in situations where you are performing operations such as calling Web Services or accessing files (IO processes) and you have some available processing power.
  It is not recommended that these changes be applied in isolation, as this causes problems. Similarly, setting these values incorrectly can also cause problems.
  Some of these recommendations involve a simple formula that involves the number of CPUs on a server. Where hyperthreading is enabled, you should base the calculation on the number of logical CPUs and not the number of physical CPUs.
  i.e. On a two-processor server with hyperthreading enabled, you should be calculating these settings based on 4 CPUs not 2.
  The recommendations I followed are detailed below, followed by an example of these setting in the machine.config file. I have also included a couple of links that hepled me identify the changes I needed; these may be of interest if you want to read into this further.
  The machine.config file can be found in the \WINDOWS\Microsoft.NET\Framework\vXXXX\CONFIG directory.
  
  maxconnection
  Controls the maximum number of outgoing HTTP connections that you can initiate from a client to a specific IP address.
  Setting the address attribute to * applies this value to all addresses. You can include multiple entries for this setting to control the maximum number of connections to specific IP addresses.
  The maxconnection parameter setting applies at the AppDomain level. By default, you can create a maximum of two connections to a specific IP address from each AppDomain in your process.
  This setting is not automatically multiplied by the number of available CPUs, you must do this yourself.
  Default 2
Recommended 12 * Number of CPUs

maxIoThreads
Controls the maximum number of I/O threads in the .NET thread pool.
  This number is automatically multiplied by the number of available CPUs.
  Default 20
Recommended 100

  
maxWorkerThreads
  Controls the maximum number of worker threads in the thread pool.
  
This number is then automatically multiplied by the number of available CPUs.
  Default 20
Recommended 100

  minWorkerThreads
  Determines how many worker threads may be made available immediately to service a remote request. This can be useful when there may be sudden rise in the number of requests, such as a burst of requests from another server or from client users. This enable ASP.NET to service requests that may be suddenly filling the ASP.NET request queue.
  
This number is then automatically multiplied by the number of available CPUs.
  
Default 1
Recommended maxWorkerThreads / 2

  minIoThreads
  Determines how many of I/O threads may be made available immediately in the .NET thread pool.
  This number is then automatically multiplied by the number of available CPUs.
  Default 1
Recommended maxIoThreads / 2
  
minFreeThreads
  Used by the worker process to queue all the incoming requests. This only applies if the number of available threads in the thread pool falls below the value for this setting.
  This setting is not automatically multiplied by the number of available CPUs, you must do this yourself.
  This setting effectively limits the number of requests that can run concurrently to maxWorkerThreads - minFreeThreads .
  Default 8
Recommended 88 * Number of CPUs
  Following the recommendation above limits the number of concurrent requests to 12 per CPU (assuming maxWorkerThreads is 100) because 100 - 88 = 12. This leaves at least 88 worker threads per CPU and 88 completion port threads per CPU available for other uses (such as for the Web service callbacks).
  
minLocalRequestFreeThreads
  Used by the worker process to queue requests from localhost, such as requests to a local Web service. This only applies if the number of available threads in the thread pool falls below this number.
  This setting is not automatically multiplied by the number of available CPUs, you must do this yourself.
  This setting is similar to minFreeThreads but it only applies to localhost requests from the local computer.
  Default 4
Recommended 76 * Number of CPUs

  Example
  An example of how these entries might look in the machine.config file is shown below. This is an edited version of this file, focusing only on those settings discussed above.
  <configuration>
<system.net>
<connectionManagement>
<add address="*" maxconnection="24" />
</connectionManagement>
</system.net>
<system.web>
<processModel autoConfig="true"
maxWorkerThreads = "100"
maxIoThreads = "100"
minWorkerThreads = "50"
minIoThreads = "50"
/>
<httpRuntime
minFreeThreads="176"
minLocalRequestFreeThreads="152"
/>
</system.web>
< /configuration>
  
  参考地址:
  http://www.iis.net/ConfigReference/system.applicationHost/applicationPools/add/cpu
  http://geekswithblogs.net/StuartBrierley/archive/2009/09/30/tuning-iis---machine.config-settings.aspx
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-99570-1-1.html 上篇帖子: WinXP IIS配置 下篇帖子: ASP.NET 应用程序建在HTTP位置,在IIS下调试ASP.NET应用程序
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表