Temporary Fix for IIS CPU Spikes

By Cory VandenBout On January 10, 2022

Temporary Fix for IIS CPU Spikes

We host a lot of sites at BizStream, with a lot of custom code behind them. Every once in a while, one of those sites has a bug that spikes the server CPU at 100% for a while, taking down all the other sites on the server. This post aims to temporarily fix the spiked CPU so it doesn’t negatively affect all the other sites on the server while you’re working furiously to figure out what is causing the spikes in the first place and fix the real problem.

The “Fix”

The temporary “fix” that we implemented was to have IIS kill the w3wp process if it surpasses 85% for more than 5 minutes.

This can be done via the IIS user interface in the following manner:

  1. Open IIS
  2. Expand the server and click Application Pools
  3. Select the application pool you’re working with
  4. Click Advanced Settings
  5. Under the CPU section, set Limit to the threshold you wish to be the maximum
    • IIS 8.5 –  85 means 85%
    • IIS 7, 7.5, 8 – 85000 means 85%
  6. Set Limit Action to “KillW3wp”
  7. Click OK to apply.

Application Pools

Things to Remember

This makes sense in our case because, with the sites, we’re hosting, from time to time, they might spike the CPU for a couple of seconds, so we didn’t want to kill the process every time. If your site CPU usage is more level, a lower limit or interval may be possible.

It also works for us because the session is saved in the database, and killing the process will not be noticeable by the end- user once the site spins back up again. However, iIf your site is dependent on IIS storing session variables, killing the process may end up causing more problems than it’s worth.
 

Click here to read more Tutorials posts
Start a Project with Us
Photo of the author, Cory VandenBout

About the author

In an office of eccentric teammates, Cory brings the normal. Low key and mellow, Cory has been developing software for BizStream since 2006 and leads the development team for YouthCenter and CaseStream, two of our products. In his off time, Cory digs home automation, movies, and plays sports and games. He enjoys spending time with his wife Becky, daughters Zoe and Ella, and his dog Leia.

View other posts by Cory

Subscribe to Updates

Stay up to date on what BizStream is doing and keep in the loop on the latest with Kentico.