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 have an apache on my server (512mb ram). The problem is that each prefork process (there are about 12 of those) takes about 3%-5% of the memory when it's waiting (I mean the httpd2-prefork processes Apache launches to process incoming connections) and about 8% when they are working. We have a Symfony app and a couple of wordpress blogs there.

Is this normal? I dropped the MaxClients number to keep the server stable but this is causing us a lot of trouble because 3 connected users at the same time can do the server crash.

Regards

share|improve this question
6  
When a web server taking up ~25 MB (including shared libs?) is causing you trouble, I would say you need more RAM. –  Sven Jul 14 '11 at 10:24
    
I do think so but I want to know if this is normal, maybe I can do something to decrease the RAM usage –  LuisClemente Jul 14 '11 at 10:28
    
Why is this a problem? Memory is there to be used, after all? Is this actually causing you an issue beyond the fact that memory is being used? –  RobM Jul 14 '11 at 10:28
    
It's a problem because when two or three users are connected at the same time the server becomes sluggy and sometimes it crashes so I want to know if the only solution is to increase RAM or there is something else I can do. –  LuisClemente Jul 14 '11 at 10:30

2 Answers 2

up vote 5 down vote accepted

That kind of memory usage is completely normal. The part I didn't get was that how exactly 5-8% memory usage is causing problems for you?

You can disable unneeded Apache modules and/or switch to some lighter alternative such as lighttpd or nginx, but I according to your description I don't think that's necessary.

Edit: the comments clarified the situation. If upgrading RAM is not an option, then consider migrating to lighttpd + FastCGI/fcgid. That way it's possible to control memory usage much more precisely as there will be only X number of PHP workers background and lighttpd can concentrate on serving the http requests. It's not Apache itself eating the RAM for you at the moment, but mod_php and PHP scripts -- Wordpress etc. can be very memory hungry.

share|improve this answer
    
Hi, thanks for your answer. The problem is that we don't have enough RAM to handle two or three users connected at the same time and because of that sometimes the server crashes... –  LuisClemente Jul 14 '11 at 10:34
    
Do you mean a single process takes 5-8% RAM and when there's suddenly tens of Apache processes that starts to hurt? Then I understand your pain. Wordpress etc. can be quite memory intensive (it's not Apache eating the RAM, but mod_php and the PHP scripts) and cause problems even with heftier hardware. One way to control memory usage is to use lighttpd with FastCGI / fcgid -- that way you have X number of PHP processes hanging there background and you can more precisely control the memory usage. lighttpd then only serves the http requests. –  Janne Pikkarainen Jul 14 '11 at 10:38
    
Exactly, one single process takes 5-8% of my RAM... –  LuisClemente Jul 14 '11 at 10:39

Apache is a fairly memory-hungry application, but you should get more than 3 or so users with 512Mb RAM.

The first thing to check is that you're not loading a lot of un-used modules when Apache starts.

Edit /etc/httpd/conf/httpd.conf and find the large list of loaded modules - remove the ones you don't need then restart Apache and notice how it uses less memory per process.

share|improve this answer

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.