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 want to set an optimum value for MaxClient in apache for my production server. What are the parameters that I should consider while calculating this value ?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Refer to the Apache Performance Tuning guide.

Quote

"You can, and should, control the MaxClients setting so that your server does not spawn   
so many children it starts swapping. This procedure for doing this is simple: determine 
the size of your average Apache process, by looking at your process list via a tool such 
as top, and divide this into your total available memory, leaving some room for other 
processes."
share|improve this answer

Complementing @Sameer answer, I read a lot of this theme and what I do is this:

  1. Get the apache process average size:

    server# ps -ylC apache2 --sort:rss
    
    S   UID   PID  PPID  C PRI  NI   RSS    SZ WCHAN  TTY          TIME CMD
    S    33  6233 25895  0  80   0  7432 72802 poll_s ?        00:00:00 apache2
    S    33  6250 25895  0  80   0  7432 72802 poll_s ?        00:00:00 apache2
    S    33  6278 25895  0  80   0  7432 72802 poll_s ?        00:00:00 apache2  
    S    33  6280 25895  0  80   0  7432 72802 poll_s ?        00:00:00 apache2 
    S    33  6577 25895  0  80   0  7432 72802 poll_s ?        00:00:00 apache2
    S    33  6299 25895  0  80   0  7772 72891 poll_s ?        00:00:00 apache2
    S    33  6295 25895  0  80   0  7776 72891 poll_s ?        00:00:00 apache2
    

    As you can see in the SZ column my apache process size is about 73 MB

  2. Make the folowing formula

    MaxClients: ((Total_Memory)(1024)(MB) - Other_processes_memory) / 73
    

    For Example: I have 16 GB RAM, I might leave free 2 GB for any other processes

    MaxClients: ((16*1024) - 2048) / 73
    MaxClient: 196 
    

This is what I use & my server is going great.

You have to consider that my apache processes are a little heavy, so you could have processes about 50 MB or less.

Regards,

share|improve this answer
    
Not necessarily a global solution as there are many many other factors and programming to consider. –  mdpc May 28 at 16:27

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.