News:

Wondering if this will always be free?  See why free is better.

Main Menu

CPU Usage

Started by CrimDa, December 10, 2016, 06:12:45 PM

Previous topic - Next topic

CrimDa

Hi All.

Apparently, my forum is going waaaay over it's allowed CPU limit usage on my host. We're allowed 2.50% and I'm regularly maxing out at 7% or 8%. What would people suggest for how to cut the CPU usage of an SMF Forum?

Illori

link to your forum? who is your host? what hosting plan do you have with them?

shawnb61

My forum had the same problem.  Our ISP even shut us down for periods of time. 

It can be any # of things, you really have to diagnose it by pouring over the access stats, access logs & error logs... 

Our saga looked like this:

First step...  We were being crawled to death.  Find the culprits...  There were some sites that were just hitting us far too hard & too often.  We poured over the access logs & took the following steps:
  -  Blocked a handful of the worst offenders by IP in CPanel
  -  Blocked Bing via some updates to .htaccess (not one IP address would work)
  -  Implemented a robots.txt (which is a voluntary standard, but interestingly, folks did respond)

One of our biggest fans in Belgium was the primary culprit...  He copied our entire site every night & translated the whole thing to French via some script...  When the site grew beyond a certain point, this turned into a major problem and extended over hours.  He did not respond to requests, so we cut his IP off via CPanel, that single move got rid of 1/2 of the problem. 

Next phase...  Fix the DB...  We also had a very fractured codebase & DB, as we had been patched and maintained by a few different volunteers over the years since SMF1.1.   Our tables had multiple charsets & collations.  We had many, many DB errors in the logs.  To address this, we: 
  -  Properly brought the ENTIRE DB to UTF8.  In some instances, this required rebuilding individual tables to properly bring them to UTF8. 
  -  Aligned all of our collations - we had several...

Next phase...  Fix the code...   Almost no mods deinstalled or installed clean, this required lots of manual updates: 
  -  Patched SMF to the current version  (We went from ~2.0.3 to 2.0.10)
  -  Deinstalled unused mods
  -  Brought all mods to current supported versions

I keep finding other things to do.  The last thing that really helped in a SIGNIFICANT fashion was when we:
  -  Upgraded php from 5.2 to 5.4.   

I doubt many folks have the DB issues we had.  Given hindsight, I think our bad code & DB exacerbated the crawling issues.  it's possible that fixing the code & DB first is all that would have been necessary.

I would start by pouring over the access & error logs.   If you are significantly behind in SMF or mods, start there. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

CrimDa

I'm using hxxp:freehostia.com [nonactive]'s Water Circle Plan. The plan comes with these features:
10 Hosted Domain(s)
2GB Disk Space
50GB Monthly Traffic
100 E-mail Accounts
Mailing Lists (Optional)
8 MySQL v.5 Databases
60MB MySQL Storage
SMTP Server
5GB VPN Traffic (w/ Hepsia)

The site is hxxp:archiesoniconline.com/board [nonactive]. I went through and blocked a few bots from crawling the site.. but it hasn't done much in way of getting the CPU limit down. I know there are a couple errors I was working to resolve but I didn't think that they would inflate the CPU so much. I've tried all that I can, really. ._.; The last thing I can do is try to install a brand new install of Simple Machine, connect the Database, and hope that it works at a lower CPU output.

shawnb61

#4
If you could narrow down the activity to what is happening when your CPU peaks, then you know where to start.

I found that dumping a days' worth of raw web log, you could do simple analysis - even just using pivot tables in Excel - & find what the problem is.  Literally just do a sort of activity, by hour, by IP address.   One example is attached.  This corresponds to the highlighted region in the 5/4/15 CPU chart above and CLEARLY identified which activity was using the bulk of my CPU on 5/4/15.   

You gotta look at the logs to diagnose what to fix.   You need to narrow down what type of activity is happening when your CPU maxes out. 

Of course, it always helps to get current:
  -  What version of SMF are you running?
  -  PHP?
  -  MySql?
  -  Are your mods all current?   

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Illori

Quote from: CrimDa on December 10, 2016, 11:00:22 PM
I'm using Freehostia.com's Water Circle Plan. The plan comes with these features:

your host is charging you really a lot for the little bit that you get from them. there are better hosts out there. check our hosting board for examples. you are getting limited resources due to the very little you are paying. i am not so sure that tracking your cpu usage will do you any good in solving the issue.

Advertisement: