Apache 2.x configuration for high load servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all my first time posting , so please be gentile. :)

 

We have 5 Apache 2.2.3 web servers behind a HAproxy load balancer. Each web server is a Quad core Xeon E5405@xxxxxxx with 16 gigs RAM and a hardware RAID 1 of 300 gigs

Apache is configure in prefork mode, as per Centos 5.5 install

 

We have recently had a 30% increase in traffic and will be expecting more. I would like to know the correct way to calculate the  proper settings for prefork.c my settings, here is what I have now...

 

<IfModule prefork.c>

StartServers       150

MinSpareServers    125

MaxSpareServers   250

ServerLimit      600

MaxClients       600

MaxRequestsPerChild   1500

</IfModule>

 

I use to have these setting even higher, but when i calculated how much the server limit and max clients are giving that i have 16 gigs minus our memcache settings and some OS stuff it leaves me with about 9 gigs of RAM left that would calculate to about 382 as the max clients setting...

I am going to add more RAM today to make a total of 24 gigs on each server, and i am going to add an additional web server in the next week or so...

 

Each day we get about 5 million visits...

The only stats i have is that when the server gets a high load i grab a snapshot of the Apache processes running and the free mem, so it looks like this..

 

This is from yesterday(not sure why that defunt is there)

 

----------------

top - 15:30:03 up 3 days, 22:10,  3 users,  load average: 9.24, 5.73, 5.27

Tasks: 365 total,   1 running, 363 sleeping,   0 stopped,   1 zombie

Cpu(s): 20.6%us,  5.6%sy,  0.0%ni, 71.0%id,  0.2%wa,  0.3%hi,  2.3%si,  0.0%st

Mem:  16435540k total,  4996748k used, 11438792k free,   624820k buffers

Swap:  2096472k total,        0k used,  2096472k free,  1907644k cached

 

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

3352 root      15   0  479m 354m  524 S  7.8  2.2 200:22.25 memcached

21064 apache    15   0     0    0    0 Z  5.8  0.0   0:23.09 httpd <defunct>

21162 apache    15   0  414m  25m  12m S  5.8  0.2   0:22.03 httpd

22107 apache    15   0  412m  24m  11m S  5.8  0.2   0:14.28 httpd

22175 apache    15   0  415m  28m  14m S  5.8  0.2   0:14.48 httpd

22177 apache    15   0  415m  29m  15m S  5.8  0.2   0:14.81 httpd

22294 apache    15   0  414m  25m  12m S  5.8  0.2   0:13.70 httpd

22318 apache    15   0  412m  24m  11m S  5.8  0.2   0:14.16 httpd

23293 apache    15   0  414m  24m  11m S  5.8  0.2   0:06.70 httpd

23366 apache    15   0  415m  28m  14m S  5.8  0.2   0:06.78 httpd

24339 apache    15   0  411m  20m 8400 S  5.8  0.1   0:00.26 httpd

24342 apache    15   0  411m  20m 8220 S  5.8  0.1   0:00.19 httpd

21168 apache    15   0  415m  27m  13m S  3.9  0.2   0:21.94 httpd

21170 apache    15   0  415m  27m  13m S  3.9  0.2   0:21.98 httpd

21182 apache    15   0  415m  29m  15m S  3.9  0.2   0:22.26 httpd

22124 apache    15   0  414m  25m  12m S  3.9  0.2   0:14.94 httpd

22181 apache    15   0  414m  25m  12m S  3.9  0.2   0:14.44 httpd

22193 apache    15   0  415m  27m  13m S  3.9  0.2   0:14.14 httpd

Apache is currently using 6207 Megs of memory...

There are 245 Apache processes running at this time.

--------------------------------

 

So the load is high, but i have free RAM left and only running 245 Apache processes, out of a possible 600? I only show the first few lines of top ….

Or do I get this wrong, does each connection have an httpd process that is run, or are child/subsequent connections, not listed on under a ps ax??

 

I get the same results on the other web serves too...

 

I removed access logging,  I disable access logging by commenting out the CustomLog directive in each virtualhost and then in httpd.com I set CustomLog value to /dev/null, this way I can keep error working too… is this ok? Here aer some of the httpd.con entries…

 

Keepalive is off

KeepAliveTimeout 3

MaxKeepAliveRequests 60

HostnameLookups Off

TraceEnable Off

UseCanonicalName Off

 

Here are loaded modules, I am not sure if I need them all, can I safely turn any off?

 

LoadModule actions_module modules/mod_actions.so

LoadModule alias_module modules/mod_alias.so

LoadModule asis_module modules/mod_asis.so

LoadModule auth_basic_module modules/mod_auth_basic.so

LoadModule auth_digest_module modules/mod_auth_digest.so

LoadModule authn_alias_module modules/mod_authn_alias.so

LoadModule authn_anon_module modules/mod_authn_anon.so

LoadModule authn_default_module modules/mod_authn_default.so

LoadModule authn_file_module modules/mod_authn_file.so

LoadModule authz_default_module modules/mod_authz_default.so

LoadModule authz_groupfile_module modules/mod_authz_groupfile.so

LoadModule authz_host_module modules/mod_authz_host.so

LoadModule authz_owner_module modules/mod_authz_owner.so

LoadModule authz_user_module modules/mod_authz_user.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule cern_meta_module modules/mod_cern_meta.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule deflate_module modules/mod_deflate.so

LoadModule dir_module modules/mod_dir.so

LoadModule env_module modules/mod_env.so

LoadModule expires_module modules/mod_expires.so

LoadModule ext_filter_module modules/mod_ext_filter.so

LoadModule geoip_module /usr/lib64/httpd/modules/mod_geoip.so

LoadModule headers_module modules/mod_headers.so

LoadModule include_module modules/mod_include.so

LoadModule info_module modules/mod_info.so

LoadModule log_config_module modules/mod_log_config.so

LoadModule logio_module modules/mod_logio.so

LoadModule mime_magic_module modules/mod_mime_magic.so

LoadModule mime_module modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule proxy_module modules/mod_proxy.so

LoadModule rewrite_module modules/mod_rewrite.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule status_module modules/mod_status.so

LoadModule userdir_module modules/mod_userdir.so

LoadModule usertrack_module modules/mod_usertrack.so

LoadModule vhost_alias_module modules/mod_vhost_alias.so

 

Thanks to all in advance.. and have a great day!

 

 

I am at the end of my rope.. :(

 

Thanks

 

 

 

 

 

 

 

Rob Morin

Systems Administrator

Infinity Labs Inc.

(514) 387-0638 Ext: 207

ilabs-email-sig

 

 


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux