Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just recently installed eaccelerator and switched php to dso everything was fine on server Server load was about 1-2 (4 cpus) and after some time server got overloaded (Server load increased to 250) and server stopped. In suphp mode server was overloading by traffic so i decided to switch it to eaccelerator and now i am lost... Can someone explain that?

share|improve this question

Stop using suPHP. It spawns a separate process for every PHP request, making eAccelerator useless (as the cache is discarded with every request).

share|improve this answer
I just made a test with small number of simulated users on website and server load went up from ~1 to ~248 (4 cpus), it made only 178 pageviews. It looks like when users establishing connection between website and computer server load goes up from there. Why is this happening? It hits the limit or what? – Hakzona Jan 10 '10 at 4:45
duskwuff - are you shure? The cache is stored in the file system and it stays available there when a new process is spawned for that user. – nikb Jan 10 '10 at 8:20

from your description tat sounds like a non-threaded apache with (dso-)php. And you have load spikes, right? I've had that before...

Your apache starts a number of server processes. If there are more incoming connections than your processes can handle, then more server processes are spawned.

Since the load is already high, spawning takes some time. If spawning takes long and there are more incoming requests before the newly spawned server processes are operational, additional processes are spawned, slowing down the machine even further. Its a situation where eaccelerator does not help much.

So what can you do? Well, you can set StartServers, MinSpareServers and MaxSpareServers in your apache config way higher than now. You should determine the average size of a single apache process on your system (since you use mod_php they should start out roughly the same size, later they start growing, because php never frees any allocated memory) and determine how many processes of that size you can fit into the amount of memory you want to spend on apache. You need to prestart enough server processes in order to stay alive throughout load spikes without too much spawning. Also remember to keep MaxRequestsPerChild at a reasonable level, in order to free the memory allocated by php on from time to time.

The long term solution would be to switch to threaded (worker-) MPM on apache, which is easier on ram because the apache threads share memory (and starting a new thread is way easier on the system than spawning a new process) and use fcgi with php. The eaccelerator is fine, I would keep it in the setup.

share|improve this answer
Thank you nikb. I just emailed this to my support. I hope it will help them to solve it. Have you had the same thing?, website is working for period of time and then boom server load goes right away up to huge number and website stops responding? – Hakzona Jan 10 '10 at 16:17
That did not help. Server load still increasing. There are many guys trying to fix this problem from support team at Hostgator. And all they do doesnt help at all. Server load is being low for some time and then increasing right away! Can you suggest anything?? – Hakzona Jan 10 '10 at 17:50
Sorry, not right away. But if you have a situation where a small increase in requests cannot be worked off, you probably have something not happening fast enough. Could be apache spawning not fast enough (my initial idea), could also be php-code. Please look for code working with large data sets, or database access generating cartesian joins or simply not using indizes. – nikb Jan 10 '10 at 18:06
Anyway, was my initial idea about you using apache-prefork right? Else I may be thinking in a wrong direction entirely. – nikb Jan 10 '10 at 18:07
I switched php to run in fcgi mode, looks good so far. Ill keep you guys posted about this problem. – Hakzona Jan 10 '10 at 19:59

Well perhaps you're asking too much of your server, even with eAccelerator enabled. How many apache processes were active when you hit the 250 load avg? It sounds like regardless of your php configuration, you need to tune your apache settings so that it won't be able to spin up more instances than your server hardware can handle.

share|improve this answer
This website should handle all traffic on this website. There are many httpd processes running when it hits 250 load. I use 2 servers one for mysql one for scripts. I copied top command for you when server load goes up: Tasks: 440 total, 303 running, 137 sleeping, 0 stopped, 0 zombie Cpu(s): 99.8%us, 0.2%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8310280k total, 4836340k used, 3473940k free, 567868k buffers Swap: 5421896k total, 4k used, 5421892k free, 2334452k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 23424 nobody 25 0 48348 29m 7220 R 3.3 0.4 0:08.89 httpd – Hakzona Jan 10 '10 at 4:47

Your Answer


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