Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I rent a small virtual server at 1und1.de. (Link, but German only) (2GB RAM dynamic, 512MB at least, 20 GB HDD) I choose to run a Ubuntu 8.04 LTS as operating system (64 Bit). I installed apache2 + php5 + mysql via the Ubuntu repositories and later eAccelerator.

I running some development stuff and a production site. This site is a kind of directory and has a few visitors (250 each day) and a lot of pages (about 7,5k). Every few days the servers freezes. This means, it's up, could be pinged, but any other action will result in "server refused connection". Looking into the admin panel it says that my kmemsize is to high and also there a lot of apache processes that were spawned.

For me it seems that my apache consumes all my ressources (and it also seems, that these freezes seems to start if Google or another crawler start to crawl the page).

Then I tried to avoid this freezes:

  • I lowered MaxKeepAliveRequests and KeepAliveTimeout in the Apache config
  • I set MaxRequestsPerChild in the setting of the prefork settings, to keep Apache workers cleaned more often.

This seems to improve the situation, but still freezes are happening.

Anyone any idea what could / should be changed?

Solution.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Figure out what the problem Actually Is:
Don't start tuning until you have used something like top or the ps command to see what is actually using the memory. It could be anywhere in the stack ( Mysql, PHP, Apache ). If it is Apache...

Switch to lighter HTTP Daemon:
Have you considered lighter HTTP daemon such as:

Consider a different MPM with Apache:
I would test this a lot before pushing this into production, but you might consider switching the the worker (instead of perfork) Multi-Processing Module (MPM). This article says this was used at dealnews.com and it helped with memory usage. I haven't done this with Ubuntu, but I think it is just:

sudo apt-get remove apache2-mpm-prefork
sudo apt-get install apache2-mpm-worker

But you might want to consider building Apache from source so you only have the modules you need, that can be kind of a big project though. Also, from the article keep in mind:

This is an important part. You can't use radical extensions in PHP when you are using worker.

Tune PHP as Well:
This IBM Developerworks article has some php tuning options that might help reduce memory as well.

Tune MySQL as Well:
The third article in the above IBM Lamp tuning article talks about MySQL tuning. This can end up using quite a bit of memory.

share|improve this answer
    
I have to stick to Apache because some of my testing stuff needs some mods that are only availabe for apache. Mysql is fine, 95% of all http-requests could be handled from a harddisk cache. I thought of switching to worker, but this needs a lot of work, but I will try. –  TheHippo Aug 17 '09 at 12:57
    
i install mpm_worker and used fastcgid (big mess), tweaked my eaccelerator and now its nearly perfect... –  TheHippo Aug 18 '09 at 11:35
    
Hippo: So are you saying you ended up going with the worker? –  Kyle Brandt Aug 18 '09 at 11:38
    
yes, installation was a mess (not that easy as you wrote) but it works really nice. thanks you answer and the interessting links. –  TheHippo Aug 18 '09 at 11:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.