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?
Stop using suPHP. It spawns a separate process for every PHP request, making eAccelerator useless (as the cache is discarded with every request).
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
andMaxSpareServers
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.
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.