What cause a blog engine site to use too much cpu?

Apr 21, 2012 at 1:40 PM

Just got my hosting account suspended for the second time, as a site running blog engine was "consuming too much cpu" as show below:

 

http://i43.tinypic.com/16aaddc.jpg

 

What can cause this to happen? The site in question doesnt have more than 300 unique visitors per day, I doubt this can cause it to overload the cpu.

Coordinator
Apr 22, 2012 at 4:14 AM

Do you have a lot of posts?  What extensions/extensions are you using?  Any custom ones?  And what version of BE are you running?

Potentially an extension could be causing high CPU ... just thinking of widgets/extensions that make remote calls like the Twitter widget and could possibly be hung up.

I don't know if it's easy or possible for you to temporarily disable items on the site and monitor the CPU usage, but if it is possible, you could try temporarily removing any extensions or widgets to see if it has an impact on CPU.  I realize the high CPU may be more of an intermittent issue which makes it more difficult to do trial and error testing.  Or if you have any custom widgets/extensions (ones not included with BE), those potentially could be causing a problem.

Another possibility would be email sending code.  I've personally had email sending code that was using the regular .NET System.Net.Mail code and would cause the CPU to spike for long periods ... this lead to my website going offline with a 503 Service Unavailable message because the hoster was setup to disable application pools which have CPU too high for too long.  So if you are sending out emails on a regular basis, you could try disabling those if possible.  There's several different email types in BE, such as the Newsletter widget, and the Comment Notification emails ("notify me when new comments are added"), or the SendCommentMail extension.

Apr 24, 2012 at 12:07 AM
Edited Apr 24, 2012 at 12:08 AM

Hmmm... I don't have any custom extensions. The only thing I added was some custom code that loads an image for each post as a front page thumbnail.

 

What I do have however is Elmah with email notifications. This sends about 200 emails per day. I wonder if this is it? I am using shared hosting so I can't monitor CPU usage.

Apr 25, 2012 at 10:59 PM

thegatekeeper,

It's virtually impossible to monitor CPU in a shared hosting environment.  But at $14.00 a month or whatever, that's a given.  Without a dedicated server, you could setup BE.NET  locally and duplicate your production blog and monitor CPU usage in Task Manager.  Another thing to look at is the number of database calls using SQL Profiler.  Your custom code that loads an image, for instance, may be making a database call on every post, which could add up.

Ben made an excellent point about email issues.  Again, not having a dedicated host it would be make it difficult to pinpoint.  Perhaps you could turn off Elmah and ask the host vendor to provide average CPU usage before and after disabling it for a few days.  That may fall outside of their service support for shared hosting, but you could ask.

Good luck,
Dave

 

May 8, 2012 at 8:49 PM
daveburke wrote:

thegatekeeper,

It's virtually impossible to monitor CPU in a shared hosting environment.  But at $14.00 a month or whatever, that's a given.  Without a dedicated server, you could setup BE.NET  locally and duplicate your production blog and monitor CPU usage in Task Manager.  Another thing to look at is the number of database calls using SQL Profiler.  Your custom code that loads an image, for instance, may be making a database call on every post, which could add up.

Ben made an excellent point about email issues.  Again, not having a dedicated host it would be make it difficult to pinpoint.  Perhaps you could turn off Elmah and ask the host vendor to provide average CPU usage before and after disabling it for a few days.  That may fall outside of their service support for shared hosting, but you could ask.

Good luck,
Dave

 

I plan on moving to a VPS soon, shared hosting is good but it has many limitations. Thanks for the answers.