Dreamhost gave me a warning that my site with just 4-5k page loads a day uses up 90% of the server resources of the shared hosting machine. More than 300 CPU minutes a day. I need to bring that down to 30 CPU minutes. What's the trick?

I'm running my site on PHP5 on CGI. I was forced to compile my own PHP because DH was not able to set certain parameters on the default Apache PHP:

session.use_only_cookies        On      Off
session.use_trans_sid           Off     On

Any help would be highly appreciated!

Comments

killes@www.drop.org’s picture

cgi-mode is known to be a ressource hog. try disabling clean urls. mod_rewrite probably eats ressources too.
--
Drupal services
My Drupal services

pamphile’s picture

The HOF module can also be a HOG.
HOF = Hall Of Fame module

Wholesale DIrectory
Business Letters
Free Classifieds

pamphile’s picture

I think the clean URL's are worth keeping though, the SEO benefits are great.

http://advertisingdiary.com
http://01webmasters.com
http://yp.bz

Samat Jain’s picture

You are using actual CGIs, or something like FastCGI (I don't know the details of FastCGI)?

CGIs require that the PHP interpreter be invoked every time a page is viewed. For those 3000 page views, PHP is being started up 3000 times. Just saying that sounds slow. Use of mod_rewrite is totally insignificant compared to that, so there is probably no point turning it off.

I'd try to work with Dreamhost to get them to make mod_php work with you, it is the most efficient. Bar that, find a new webhost.

flipp3r’s picture

My site has been online for 4 years, so perhaps that's part of it, but I was getting hit by bots almost non-stop last week. I would have up to 1000 "guests" on the site, so you know that allot had been hitting the site. With blocking bots via Apache I now have gotten that down to 20-30 at any time.

If you don't run your own server, you can add to the .htaccess file, learn how to do it here:

http://www.jcornelius.com/articles/deny-apache-user-agent/

f

multiplex’s picture

If you've already compiled PHP once and you really need to get the CPU load down, I think you should re-compile your PHP again but with PHP as module for Apache (if your host allows that).
Then you could use a caching system, like Turck MMcache, APC or Zend Optimizer, which would get rid of all the overhead compiling for your scripts.

I'm using PHP4.11 on one of my servers as module for Apache2 and using Turck MMcache, and it works fine with Drupal. (Speeds up around 300%)

--- MultipleX
www.hambastegimeli.com
Don't click this link if you don't know Farsi!

iraszl’s picture

Thank you. I switched back to Apache PHP that is the default by Dreamhost. It works perfectly now.