{"id":2687,"date":"2019-12-10T09:29:41","date_gmt":"2019-12-10T08:29:41","guid":{"rendered":"https:\/\/laurentvanacker.com\/?p=2687"},"modified":"2022-12-09T09:50:13","modified_gmt":"2022-12-09T08:50:13","slug":"cpu-limit-in-iis-application-pools-limitation-cpu-des-application-pools-iis","status":"publish","type":"post","link":"https:\/\/laurentvanacker.com\/index.php\/2019\/12\/10\/cpu-limit-in-iis-application-pools-limitation-cpu-des-application-pools-iis\/","title":{"rendered":"CPU Limit in IIS Application Pools \/ Limitation CPU des Application Pools IIS"},"content":{"rendered":"<p><a href=\"#en-us\" name=\"fr-fr\">Go to English version<\/a><\/p>\n<p>Un de mes clients m&rsquo;a r\u00e9cemment remont\u00e9 que son journal d&rsquo;application Syst\u00e8me \u00e9tait pollu\u00e9 par l&rsquo;\u00e9v\u00e9nement <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/dd364226(v=ws.10)\">WAS\/5025<\/a> relatif \u00e0 IIS. Au premier abord cela paraissait simple : On d\u00e9passait le seuil CPU param\u00e9tr\u00e9 sur les \u00ab\u00a0application pools\u00a0\u00bb (\u00ab\u00a00\u00a0\u00bb par d\u00e9faut donc pas de limitation CPU).\u00a0 Or un petit tour sur l&rsquo;interface graphique pour les \u00ab\u00a0applications pools\u00a0\u00bb incrimin\u00e9s me montrait une valeur positionn\u00e9e \u00e0 0.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2689 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU.jpg\" alt=\"\" width=\"350\" height=\"438\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU.jpg 435w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU-240x300.jpg 240w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>De prime abord le probl\u00e8me n&rsquo;\u00e9tait pas l\u00e0 &#8230;<\/p>\n<p>Or il faut se souvenir qu&rsquo;avant IIS 8.5 le seuil de CPU \u00e9tait exprim\u00e9 dans l&rsquo;interface graphique et dans le fichier <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> en 1\/1000 i\u00e8me de pourcentage. Pour valoriser le seuil CPU \u00e0 50% il fallait donc rentrer 50 000. Depuis IIS 8.5 la valeur est exprim\u00e9e en pourcentage (ce qui est d&rsquo;ailleurs plus logique) dans l&rsquo;interface graphique (voir la capture d&rsquo;\u00e9cran ci-dessus prise depuis IIS 10.0) mais la valeur demeure stock\u00e9e en 1\/1000 i\u00e8me de pourcentage dans le fichier <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a>. Ainsi vous rentrez 50 dans l&rsquo;interface graphique mais la valeur stock\u00e9e dans le fichier <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> sera 50 000.<\/p>\n<p>Se pourrait-il que interface graphique puisse m&rsquo;induire en erreur ? Quelle valeur est affich\u00e9e dans l&rsquo;interface graphique si dans le fichier est stock\u00e9e une valeur inf\u00e9rieure \u00e0 1 000 ?<\/p>\n<p>V\u00e9rifions \u00e0 l&rsquo;aide de l&rsquo;\u00e9diteur de configuration et de PowerShell :<\/p>\n<ul>\n<li>Editeur de configuration<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2691 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor.png\" alt=\"\" width=\"750\" height=\"408\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor.png 1262w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-300x163.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-1024x557.png 1024w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-768x418.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>PowerShell<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2693 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell.png\" alt=\"\" width=\"750\" height=\"306\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell.png 1016w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell-300x123.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell-768x314.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>Bingo ! Une valeur 700 (donc 0.7% !!! ==&gt; 700\/1000) \u00e9tait \u00e9trangement positionn\u00e9e dans le fichier <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a>.<\/p>\n<p>Apr\u00e8s valorisation de la valeur \u00e0 0 en PowerShell, les \u00e9v\u00e9nements <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/dd364226(v=ws.10)\">WAS\/5025<\/a> relatifs \u00e0 IIS ont disparus.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nSet-WebConfigurationProperty -pspath 'MACHINE\/WEBROOT\/APPHOST' -filter &quot;system.applicationHost\/applicationPools\/add&#x5B;@name='DefaultAppPool']\/cpu&quot; -name &quot;limit&quot; -value 0\r\n\r\n<\/pre>\n<p>Quelques liens utiles :<\/p>\n<ul>\n<li><a href=\"https:\/\/laurentvanacker.com\/index.php\/2019\/11\/14\/liste-des-evenements-relatifs-a-iis-list-of-iis-related-event-ids\/\">Liste des \u00e9v\u00e9nements relatifs \u00e0 IIS \/ List of IIS related event IDs<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/configuration\/system.applicationhost\/applicationpools\/add\/cpu\">CPU Settings for an Application Pool &lt;cpu&gt;<\/a><\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"http:\/\/laurentvanacker.com\/wp-content\/uploads\/2017\/01\/012717_1333_Fusionnerde1.png\" alt=\"\" \/><\/p>\n<p><a href=\"#fr-FR\" name=\"en-us\">Aller \u00e0 la version fran\u00e7aise<\/a><\/p>\n<p>A customer of mine recently told me that his System application log was flooded by <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/dd364226(v=ws.10)\">WAS\/5025<\/a> IIS events. At first it seemed simple: It exceeded the CPU threshold set on the \u00ab\u00a0application pools\u00a0\u00bb (\u00ab\u00a00\u00a0\u00bb by default so no CPU limitation). But a little tour on the GUI for the \u00ab\u00a0applications pools\u00a0\u00bb incriminated showed me a value set to 0.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-2689 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU.jpg\" alt=\"\" width=\"350\" height=\"438\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU.jpg 435w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPU-240x300.jpg 240w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>The problem seems not to be there &#8230;<\/p>\n<p>However, it must be remembered that before IIS 8.5 the CPU threshold was expressed in the GUI and in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> file in 1\/1000ths of one percent. To value the CPU threshold at 50%, it was necessary to enter 50 000. Since IIS 8.5 the value is expressed as a percentage (which is more logical) in the GUI (see screenshot above taken from an IIS 10.0 server) but the value remains stored in 1\/1000ths of one percent in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> file. So you enter 50 in the GUI but the value stored in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> file will be 50 000.<\/p>\n<p>Could it be possible that GUI can mislead me? What value is displayed in the GUI if in the file is stored a value less than 1 000?<\/p>\n<p>Let&rsquo;s check using the Configuration Editor and PowerShell:<\/p>\n<ul>\n<li>Configuration Editor<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2691 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor.png\" alt=\"\" width=\"750\" height=\"408\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor.png 1262w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-300x163.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-1024x557.png 1024w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUConfigurationEditor-768x418.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>PowerShell<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-2693 aligncenter\" src=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell.png\" alt=\"\" width=\"750\" height=\"306\" srcset=\"https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell.png 1016w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell-300x123.png 300w, https:\/\/laurentvanacker.com\/wp-content\/uploads\/2019\/12\/AppPoolCPUPowerShell-768x314.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Bingo! A value of 700 (so 0.7% !!! ==&gt; 700\/1000) was strangely positioned in the <a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/get-started\/planning-your-iis-architecture\/introduction-to-applicationhostconfig\">applicationHost.config<\/a> file.<\/p>\n<p>After valuing the value at 0 in PowerShell, the <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/windows\/it-pro\/windows-server-2008-R2-and-2008\/dd364226(v=ws.10)\">WAS\/5025<\/a> events related to IIS disappeared.<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\"> \r\nSet-WebConfigurationProperty -pspath 'MACHINE\/WEBROOT\/APPHOST' -filter &quot;system.applicationHost\/applicationPools\/add&#x5B;@name='DefaultAppPool']\/cpu&quot; -name &quot;limit&quot; -value 0 \r\n<\/pre>\n<p>Some useful links:<\/p>\n<ul>\n<li><a href=\"https:\/\/laurentvanacker.com\/index.php\/2019\/11\/14\/liste-des-evenements-relatifs-a-iis-list-of-iis-related-event-ids\/\">Liste des \u00e9v\u00e9nements relatifs \u00e0 IIS \/ List of IIS related event IDs<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/iis\/configuration\/system.applicationhost\/applicationpools\/add\/cpu\">CPU Settings for an Application Pool &lt;cpu&gt;<\/a><\/li>\n<\/ul>\n<p>Laurent.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go to English version Un de mes clients m&rsquo;a r\u00e9cemment remont\u00e9 que son journal d&rsquo;application Syst\u00e8me \u00e9tait pollu\u00e9 par l&rsquo;\u00e9v\u00e9nement WAS\/5025 relatif \u00e0 IIS. Au [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":2465,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,9,19],"tags":[],"class_list":["post-2687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-iis","category-performances","category-powershell"],"_links":{"self":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/2687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/comments?post=2687"}],"version-history":[{"count":15,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/2687\/revisions"}],"predecessor-version":[{"id":2727,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/posts\/2687\/revisions\/2727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/media\/2465"}],"wp:attachment":[{"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/media?parent=2687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/categories?post=2687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentvanacker.com\/index.php\/wp-json\/wp\/v2\/tags?post=2687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}