I'm optimizing a apache server for ads displaying with OpenX. Actually, we dont got a lot of traffic, and the general load of the machine is really low, but actually, the CPU usage is over the 70%.
Ok, here you have some important info:
[root@dns01 ~]# uptime 11:55:49 up 2 days, 21:08, 0 users, load average: 0.72, 0.71, 0.75 [root@dns01 ~]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU D510 @ 1.66GHz stepping : 10 cpu MHz : 1666.781 cache size : 512 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 0 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm bogomips : 3333.56
processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU D510 @ 1.66GHz stepping : 10 cpu MHz : 1666.781 cache size : 512 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 2 apicid : 1 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm bogomips : 3333.41
processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU D510 @ 1.66GHz stepping : 10 cpu MHz : 1666.781 cache size : 512 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm bogomips : 3333.58
processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 28 model name : Intel(R) Atom(TM) CPU D510 @ 1.66GHz stepping : 10 cpu MHz : 1666.781 cache size : 512 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 2 apicid : 3 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 10 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl tm2 ssse3 cx16 xtpr lahf_lm bogomips : 3333.56
[root@dns01 ~]# free -m total used free shared buffers cached Mem: 2560 365 2194 0 0 0 -/+ buffers/cache: 365 2194 Swap: 0 0 0 [root@dns01 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/simfs 100G 1.9G 99G 2% / none 1.3G 4.0K 1.3G 1% /dev tmpfs 1.3G 0 1.3G 0% /usr/local/psa/handlers/before-local tmpfs 1.3G 0 1.3G 0% /usr/local/psa/handlers/before-queue tmpfs 1.3G 0 1.3G 0% /usr/local/psa/handlers/before-remote tmpfs 1.3G 0 1.3G 0% /usr/local/psa/handlers/info tmpfs 1.3G 0 1.3G 0% /usr/local/psa/handlers/spool [root@dns01 ~]# cat /etc/redhat-release CentOS release 5.6 (Final) [root@dns01 ~]#
I setup the MaxClients, using the info available in http://httpd.apache.org/docs/2.2/misc/perf-tuning.html, leaving the 50% of resources for MySQL and other process.
The single biggest hardware issue affecting webserver performance is RAM. A webserver should never ever have to swap, as swapping increases the latency of each request beyond a point that users consider "fast enough". This causes users to hit stop and reload, further increasing the load. 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.
Ok. At this point. I think I'm having an issue with the rest of the settings of the prefork.c.
StartServers 5 MinSpareServers 10 MaxSpareServers 20 MaxClients 75 MaxRequestsPerChild 100
Can you please suggest to me any positive changes?
Thank you in advanced for all your time.