Iis worker process грузит процессор

My CPU usage is 100% most of the the time in Windows Server 2008-R2 with my own vps, vmware, quad core, and 4GB Ram. When I open windows Task Manager and go to the resource monitor I see that 100% usage is because of workerprocess.exe . I have 3 websites in my IIS.

  • How can I figure out which web site causes that usage
  • How can I limit it to 80% usage of CPU?
  • Could it be a DDOS attack?
  • Is there any way to prevent DDOS?

I installed eset-nod32 on my vps, but it doesn’t show any attack in the logs. I’ve tried searching about IIS and preventing DDOS, and just found an extension for banning IP addresses, but how can I find which IP address are generating traffic?

The web site is written in ASP.NET and C# . How can I determine what is happening on that web site and which lines of codes are causing that cpu usage?

Also, one of my web sites should access administrator’s desktop and read and write some files. So because of that I changed its application pool -> identity (Process Model) to local system, and I don’t know if it is related with the CPU usage or not.

8 Answers 8

Well, this can take long time to figure out. Few points to narrow it down:

  • Identify what is killing the CPU. I recommend Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
  • Identify what AppPool is causing this
  • Fix your code

Diagnosing

In terms of diagnosing what App Pool is causing trouble, you can:

  1. Select the server
  2. Go to IIS > Worker Processes

This should bring up a menu like this so you can determine which App Pool is running amok.

From there you can simply restart the the app pool and 9 times out of 10 that will fix any immediate issues you’re having.

Treating

Unless you run some sort of controversial business, this is probably not a DDOS attack. It’s likely that some code is just hanging because it couldn’t get through to another server or got stuck in a loop or mis-allocated resources or your app pool just hasn’t been recycled in a while.

You can deal with this problem programmatically without having to manually identify, log in, and recycle the app pool. Just configure the CPU property on your App Pool. You can have it kill (and automatically restart) your process anytime you reach a CPU threshold for a certain amount of time.

Читайте также:  Чем открыть лог файл

In your case, if you want it to restart at 80%, you can right click on the app pool and go to Advanced Settings and apply the following configurations:

NOTE: As kraken101 pointed out, different IIS GUIs have treated this differently over time. While the config value is always in 1/1000 of a %, sometimes the GUI takes the whole percent.

You can add this to your config section like this:

Preventing

The steps above will help fix some things once they’ve broken, but won’t really solve any underlying issues you have.

Here are some resources on doing performance monitoring:

Use PerfMon to collect data and DebugDiag to analyse.

Found this link while searching for similar issue.

I was facing the same issues recently and found a solution which worked for me and reduced the memory consumption level upto a great extent.

Solution:

First of all find the application which is causing heavy memory usage.

You can find this in the Details section of the Task Manager.

  1. Open the IIS manager.
  2. Click on Application Pools. You’ll find many application pools which your system is using.
  3. Now from the task manager you’ve found which application is causing the heavy memory consumption. There would be multiple options for that and you need to select the one which is having ‘1’ in it’s Application column of your web application.
  4. When you click on the application pool on the right hand side you’ll see an option Advance settings under Edit Application pools. Go to Advanced Settings. 5.Now under General category set the Enable 32-bit Applications to True
  5. Restart the IIS server or you can see the consumption goes down in performance section of your Task Manager.

If this solution works for you please add a comment so that I can know.

Решение проблем с производительностью IIS

Иногда бывает, что на сервере IIS начинают происходить странные дела. Так например у меня возникла ситуация, в которой один из процессов w3wp.exe время от времени начинал занимать под свои вычисления весь ресурс одного из ядер (был бы одноядерный процессор было бы использование процессора на 99% или 100%). Для тех, кто не знает процесс w3wp.exe кроме всего прочего отвечает за исполнение серверного кода ASP, ASP.NET скриптов. Ясно было что, какой-то скрипт производит излишнюю нагрузку. Такое поведение для меня было неприемлимым и я постарался решить эту задачу.

Читайте также:  Epidemz net как зайти

Первым делом я захотел выяснить какое из используемых нами приложений производит эту дополнительную нагрузку. Для этого я попробовал вынести все приложения в отдельные виртуальные каталоги, задав для каждого отдельный пул приложений, они же Application pool (для каждого пула приложений используется отдельный процесс w3wp.exe), попутно определяя какой из процессов к какому пулу относится. Сделать это можно довольно просто при помощи утилиты Sysinternals Process explorer. Для этого достаточно зайти в свойства процесса (при этом подсказкой может служить то, что приложения написанные при помощи ASP.NET будут подсвечены жёлтой строкой), и на вкладке Image посмотреть строку Command line, из которой видно, что название пула приложений передаётся процессу w3wp.exe через параметр «ap». Так например команда запуска для пула приложений с именем «dotnet4» будет выглядеть так:

c:windowssystem32inetsrvw3wp.exe -a \.pipeiisipmceXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX -t 20 -ap "dotnet4"

Впоследствие эти действия оказались по большему счёту бесполезными, но умение определять нужный процесс w3wp оказалось впоследствии полезным и мне и нашим разработчикам выполняющим удалённую отладку в Visual Studio.

We have 12 web sites on Windows 2008 R2 Standard 64 bit, 2GB RAM, 2 Processors. It is run in VMware at a hosting company and has been active about 2 months. ASP.Net code in Framework 4.0. No code changes or Windows Updates applied since 2/23/15.

On 3/5/15, one web (X.com) site started slowing down or stopping completely for users. There may be up to 25 or 50 users hitting it simultaneously. Task Manager Performance Tab showed CPU usage pegged at 100% and Processes Tab showed w3wp.exe IIS Worker Process for X.com.

This would last 15 to 120 seconds. Sometimes stopping on its own – sometimes I killed the process. It reoccurred at random times, getting more frequent as the day progressed. Resetting IIS and server reboot only provided temporary relief. All other web sites functioning normally, including one with twice the user load.

Only cure was to move x.com to a similar VM used for development. No incidents since.

So – what the heck. Thanks in advance.

Читайте также:  Мелкая рябь на экране монитора
Premium Content
Premium Content
  • Facebook
  • Twitter
  • LinkedIn
  • https://www.experts-exchange.com/questions/28632136/IIS-Worker-Process-Uses-100-CPU.html copy

1. Have you looked into the site’s http logs and analyzed them?
2. Have you looked into the server’s http error logs (different from #1)?
2a. Http Error Log location: C:WindowsSystem32LogFil esHTTPERR
3. Are there errors/warnings in the event logs?
4. Is there a database component associated with the app?
4a. If yes, was there equivalent activity on the database for the app?
5. Also, how much RAM was the process using?

I recommend that you look into the site’s http logs (in #1 and #2) to see what activity occurred during the timeframe of the issue.

Hopefully you have more than the default fields enabled in the http logging feature. Otherwise, I recommend enabling all W3C fields. In your case, there are fields that may be of help. For example, time-taken, cs-bytes and sc-bytes.

Basically these fields are defined as:

time-taken = how long the request took to be executed, in milliseconds
cs-bytes = bytes sent by the client -or- bytes received by the server (inbound data)
sc-bytes = bytes sent by the server (outbound data)

Of course the field "cs-uri-stem" is important to see what URL the client request hit. The "cs-uri-query" may also be of use if the app uses query strings instead of posting back the data.

In the HTTPERR logs, "Timer_ConnectionIdle" entries can be ignored.

Use task manager to see how much RAM a process is consuming. I would select the following columns to be visible under the Processes tab in Task Manager:

1. Image Name
2. PID – process ID
3. User Name
4. CPU – [currently CPU usage in percent]
5. CPU Time – [overall time the process has on the CPU]
6. Working Set (Memory) – [memory used by a process but can be released if needed]
7. Memory (Private Working Set) – [memory reserved exclusively for the process]
8. Handles
9. Threads

#7 is a good estimate of how much RAM a process is using. Measuring the real amount of RAM a process is a bit more complicated but Private Working Set is useful for quickly troubleshooting issues.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock detector