High CPU same time every night.

Conor Dunk asked on January 18, 2017 09:12

Hi. We deployed our kentico site one week ago to production environment. Since then every night just after midnight the cpu peaks at 100% until our hosting provider manually recycles the app pool. (Recycles at 2)

I've disabled all the scheduled tasks running during the nightime with no luck. The only difference from our testing and production environment is more RAM.

Ive read other posts around this issue but I'm hesitent just installing hotfixes without truly understanding the issue.

Apart from schedule tasks. Are there any application process which run at the same time I may be unaware of?

Thank you. Conor

Recent Answers


Ilesh Mistry answered on January 18, 2017 10:22

Hi Conor, you might have already checked this, but I am assuming there are no other windows services running at midnight? Are there other sites running on the same box?

It depends on the production environment, but we sometimes use monitoring tools and if you are using this Applications Insights, could potential help with this to diagnose this furter? Or another option is to use New Relic?

Thanks Ilesh

1 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on January 18, 2017 15:28

We have run into similar issues with App Pools 'self-recycling' at certain intervals (it's a setting on the App Pool), and whenever it would self-recycle the site would kind of blow up until we manually recycle (very odd behavior indeed). Stopping the "recycle after X hours no matter what" type of thing may be the issue.

Here's an article showing how to change it in IIS

https://www.iis.net/configreference/system.applicationhost/applicationpools/add/recycling/periodicrestart

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on January 18, 2017 18:24

You sad "hosting provider"? Is this a dedicated server hosting only your kentico site? If not - it might be just collateral damage. You should start by ruling out issues (disabling things) one by one .

You can play around with app pool settings by resetting app pool if CPU hits whatever limit (google it)

<applicationPools>
   <add name="DefaultAppPool">
     <cpu limit="80000" action="KillW3wp" resetInterval="00:01:00" />
   </add>
</applicationPools>

or like Trevor mentioned above, but that probably does not the answer questions why? And it kinda unstable because there is no guaranties that it doesn't happen during the day.

You know your set up best so it is hard to diagnose. Anyway here is my 2 cents in addition to what was said before:

  • Check also your smart search indexes, how big they are? and when re indexing is happening. Huge indexes can bring down a power server down easily. It might make sense to split them.

  • Check server logs (it might be result of the massive crawling) - you need to set pace in your robots.txt to prevent some bots from doing that. See who is coming, how often and what pages? It might need optimization or caching (I assuming it was done but who knows). One page can do lots of shit.

  • How is memory consumption/garbage collection? is is stable? No leaks? monitor your Memory / garbage collection statistic in the admin/system tab. Make sure that you have less objects when move up the generations: generation 1 should not have more objects where generation 2 etc. If something wrong here - then it is related to your custom code.

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.