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 activated Apache Worker on my VPS and I'm having problems, 'cause the website is crashing when 3000 users are accessing the website. I'm using as counter.

My Apache Worker configuration:

KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 1

<IfModule mpm_worker_module>
ServerLimit 20000
StartServer 8000
MinSpareThreads 10400
MaxSpareThreads 14200
ThreadLimit 5
ThreadsPerChild 5
MaxClients 20000
MaxRequestsPerChild 0

The VPS have the SO: Debian 64 LAMP, memory: 14gb and CPU: 24ghz

What I could to do to give a best performance?

share|improve this question
Did you try changing the MaxRequestsPerChild to something like 1000 ? – melsayed Nov 24 '12 at 18:16
Also, what is the average size of the apache process size on your server ? – melsayed Nov 24 '12 at 18:17
Thanks by your feedback.. I will try the MaxRequestsPerChild to 1000. But, what means "average size of the apache process size on your server" ???? – user1618606 Nov 24 '12 at 18:24
Apaches spawns several processes to serve your clients. Each process consumes an amount of memory. You can get a list of processes sorted by their memory consumption: ps -ylC apache2 --sort:rss – melsayed Nov 24 '12 at 19:06
Also, is apache currently crashing with the worker mpm, our it's not any more? – melsayed Nov 24 '12 at 19:15
up vote 0 down vote accepted

Try this configuration for starters (quite a lot for a VPS server):

MaxClients 2000
ThreadsPerChild 50
ServerLimit 40

This give you 2000 threads and 40 processes (50 threads per process) to handle max 2000 clients simultaneously. If you want to increase ThreadsPerChild to value greater than 64 don't forget to change ThreadLimit also.

share|improve this answer
<IfModule mpm_worker_module> MaxClients 2000 ThreadsPerChild 50 ServerLimit 40 </IfModule> And I delete the other vars (MinSpareThreads, MaxSpareThreads)??? – user1618606 Nov 24 '12 at 23:39
yes, you can delete those. – FINESEC Nov 24 '12 at 23:41
Good, I'll try this tomorrow! – user1618606 Nov 25 '12 at 0:10
FINESEC - There is no any effect in the performance. I used this configuration: <IfModule mpm_worker_module> MaxClients 4000 ThreadsPerChild 50 ServerLimit 80 </IfModule> When the website was with 2,500 simultaneous users, it started to crash again. I'm using only php (without mysql). The memory usage was 1300 in use/7400 total Any idea? – user1618606 Nov 26 '12 at 1:45
Try to delete all those directives (default configuration will be used). If it still crashes then there's something wrong with your server / apache installation. – FINESEC Nov 26 '12 at 9:21

It looks like you are running out memory and apache is crashing because it using more than the available memory.

I am not very familiar with the worker mpm, but I think your configuration far exceeds your available memory.

For example, you have 5 threads per process, and 20000 MaxClient. That means that to serve your Max clients, you need 20000/5=4000 concurrent apache processes. Factoring in 13 GB memory (1 GB for system), and an average of 15MB for apache process size, you can serve about 4300 clients only.

I am assuming you are running a database there, too. This makes it logical for apache to die at around 3000 clients.

You should reduce the number of MaxClients and MinSpareThreads as @David Schwartz suggested.

share|improve this answer
Fine. I'll try this. In 30 minutes, I come back with the result. – user1618606 Nov 24 '12 at 21:21
Your configuration does not make any sense. You are trying to force threaded MPM to behave like a prefork MPM. Apache is crashing because you're trying to fork too many processes. This is not optimal. You shouldn't really have more than 1000 processes running on such system. You should probably read this: – FINESEC Nov 24 '12 at 22:06
Fine. But what could be the ideal configuration for this demand? – user1618606 Nov 24 '12 at 22:42

Your Answer


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.