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 read many posts regarding the Apache configuration, and tried to find the best values for our servers. To make sure what's best I used JMeter to simulate 2100 connections per second. After many rounds of fine tuning i got to the following configuration:

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   10
ServerLimit     2048
MaxClients       2048
MaxRequestsPerChild  20000
</IfModule>

Server details:

[root@web06 ~]# free
                 total       used       free     shared    buffers     cached
    Mem:       3814660    1070152    2744508          0     146788     766944
    -/+ buffers/cache:     156420    3658240
    Swap:      5210104          0    5210104
[root@web06 ~]# grep -c processor /proc/cpuinfo
4
[root@web06 ~]# uname --a
Linux web06 2.6.18-164.el5PAE #1 SMP Thu Sep 3 04:10:44 EDT 2009 i686 i686 i386 GNU/Linux

Memory used by a single Apache process:

[root@web06 ~]#  cat /proc/5903/status  | grep VmRSS 
VmRSS:     10076 kB

I know that my configuration is a bit high, but configuration gave me the best result on the stress test. I would appreciate your input, should I change anything?

Please note- I know there are better alternative to Apache, but I don't have the resources to make this kind of a change at the moment.

Thanks!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Well, is your server capable of running 2048 concurrent Apache processes (as you set in ServerLimit/MaxClients)? I bet it is not and actually you don't need so many concurrent Apache workers. I highly recommend you to setup an asynchronous reverse proxy like nginx or lighttpd to offload handling clients w/slow connections to that async proxy. And believe me most of the public web clients are slow enough to take most of Apache worker time just to handle uploading of already generated content to them. And I don't think you will ever need more than 25 concurrent Apache workers if you set up reverse proxying properly.

share|improve this answer
    
Thanks for your help, at the moment even after 2K connections I still have free memory and CPU, that's why I set it to sch a high number. The server suppose to support 3K connection, so I though that high number of servers will help with that. –  Kuf Aug 8 '12 at 12:48
    
Could you please post an output of ps axf | grep httpd when you have 2k conns (I highly doubt you can have 2k truly concurrent conns in this environment)? A real number of concurrent connections is close to the number of concurrent Apache processes. –  Alex Aug 8 '12 at 12:51
    
sorry, you're right. when saying I have 2K connection, i mean that 2k people will log in within a 10 seconds or so. when running the command you've wrote I had 80 services max. Does it means my configuration is wrong? –  Kuf Aug 8 '12 at 13:01
1  
Well, the problem with big MaxClients settings is that if traffic increases when more users come nothing will prevent Apache workers from eating all available memory and swap. Your server will become effectively unreachable then. So I highly recommend to put a sane cap there, and 80 looks reasonable. –  Alex Aug 8 '12 at 13:05
    
Thanks! I will test it again with 80 limit and check if i don't loose any connections. –  Kuf Aug 8 '12 at 13:10

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.