--- On Mon, 23/8/10, jaydeep chaudhari <chaudhari.jayd...@gmail.com> wrote:
From: jaydeep chaudhari <chaudhari.jayd...@gmail.com> Subject: [Linux_Mantra] Apachi is eating my cpu To: Linux_Mantra@yahoogroups.com, linuxvada...@yahoogroups.com Date: Monday, 23 August, 2010, 6:56 PM Dear All, I am getting below mentioned error on my server ( Cent OS 5.2, Arch= ia64, 8GB ram quadcore processor) Can anyone has faced same issue before? Please let me know if anyone has solution for this top - 17:25:26 up 3 days, 5:46, 5 users, load average: 83.86, 75.80, 73.61 Tasks: 284 total, 32 running, 252 sleeping, 0 stopped, 0 zombie Cpu(s): 98.2%us, 1.7%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 8176480k total, 8125824k used, 50656k free, 308928k buffers Swap: 16777184k total, 384k used, 16776800k free, 4593648k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2239 apache 16 0 160m 59m 13m R 29 0.7 2:12.41 /usr/sbin/httpd 10200 apache 25 0 158m 58m 13m R 13 0.7 0:31.80 /usr/sbin/httpd 12633 apache 25 0 161m 61m 14m R 13 0.8 3:13.62 /usr/sbin/httpd 13449 apache 25 0 156m 51m 11m R 13 0.6 0:19.00 /usr/sbin/httpd 13480 apache 25 0 156m 52m 13m R 13 0.7 0:17.11 /usr/sbin/httpd 13735 apache 25 0 162m 62m 14m R 13 0.8 4:10.05 /usr/sbin/httpd 15008 apache 20 0 156m 52m 13m R 13 0.7 0:07.55 /usr/sbin/httpd 15111 qmailq 25 0 144m 141m 2512 R 13 1.8 0:02.61 /usr/bin/clamscan --tempdir=/tmp/clamav.15108 -r --no-summary - 15443 qmailq 25 0 136m 132m 2176 R 13 1.7 0:02.20 /usr/bin/clamscan --tempdir=/tmp/clamav.15439 -r --no-summary - 2542 apache 25 0 156m 57m 14m R 13 0.7 2:49.90 /usr/sbin/httpd 4171 apache 21 0 156m 55m 13m R 13 0.7 2:19.41 /usr/sbin/httpd 10178 apache 25 0 156m 53m 13m R 13 0.7 0:37.95 /usr/sbin/httpd 4251 apache 25 0 161m 59m 14m R 13 0.7 2:40.70 /usr/sbin/httpd 13458 apache 25 0 156m 52m 13m R 12 0.7 0:15.14 /usr/sbin/httpd 10181 apache 25 0 157m 54m 12m R 12 0.7 0:45.07 /usr/sbin/httpd 23818 apache 25 0 160m 61m 14m R 11 0.8 4:13.89 /usr/sbin/httpd 32591 apache 25 0 156m 57m 14m R 10 0.7 3:12.05 /usr/sbin/httpd 1387 apache 25 0 156m 55m 14m R 10 0.7 1:38.51 /usr/sbin/httpd 4507 apache 25 0 169m 68m 14m R 10 0.9 2:22.30 /usr/sbin/httpd 13457 apache 25 0 156m 52m 13m R 10 0.7 0:20.15 /usr/sbin/httpd 13494 apache 25 0 156m 53m 13m R 10 0.7 0:17.70 /usr/sbin/httpd 15275 qmailq 25 0 144m 141m 2512 R 10 1.8 0:02.60 /usr/bin/clamscan --tempdir=/tmp/clamav.15272 -r --no-summary - 23417 apache 25 0 162m 63m 14m R 10 0.8 3:40.51 /usr/sbin/httpd 1240 apache 25 0 156m 55m 14m S 8 0.7 1:23.50 /usr/sbin/httpd 15056 apache 15 0 79024 34m 12m S 7 0.4 0:02.40 /usr/sbin/httpd 15279 mysql 15 0 468m 61m 12m S 7 0.8 26:55.86 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --u 648 apache 16 0 168m 68m 14m S 7 0.9 2:29.80 /usr/sbin/httpd 15572 qmailq 25 0 68912 63m 2176 R 7 0.8 0:00.70 /usr/bin/clamscan --tempdir=/tmp/clamav.15568 -r --no-summary - 23781 apache 16 0 159m 59m 14m S 7 0.7 4:15.02 /usr/sbin/httpd -- Regards, Jay 9870567672 [ <!-- #yiv164665374 #yiv164665374ygrp-mkp { border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;} #yiv164665374 #yiv164665374ygrp-mkp hr { border:1px solid #d8d8d8;} #yiv164665374 #yiv164665374ygrp-mkp #yiv164665374hd { color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;} #yiv164665374 #yiv164665374ygrp-mkp #yiv164665374ads { margin-bottom:10px;} #yiv164665374 #yiv164665374ygrp-mkp .yiv164665374ad { padding:0 0;} #yiv164665374 #yiv164665374ygrp-mkp .yiv164665374ad p { margin:0;} #yiv164665374 #yiv164665374ygrp-mkp .yiv164665374ad a { color:#0000ff;text-decoration:none;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ygrp-lc { font-family:Arial;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ygrp-lc #yiv164665374hd { margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ygrp-lc .yiv164665374ad { margin-bottom:10px;padding:0 0;} #yiv164665374 a { color:#1e66ae;} #yiv164665374 #yiv164665374actions { font-family:Verdana;font-size:11px;padding:10px 0;} #yiv164665374 #yiv164665374activity { background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;} #yiv164665374 #yiv164665374activity span { font-weight:700;} #yiv164665374 #yiv164665374activity span:first-child { text-transform:uppercase;} #yiv164665374 #yiv164665374activity span a { color:#5085b6;text-decoration:none;} #yiv164665374 #yiv164665374activity span span { color:#ff7900;} #yiv164665374 #yiv164665374activity span .yiv164665374underline { text-decoration:underline;} #yiv164665374 .yiv164665374attach { clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;} #yiv164665374 .yiv164665374attach div a { text-decoration:none;} #yiv164665374 .yiv164665374attach img { border:none;padding-right:5px;} #yiv164665374 .yiv164665374attach label { display:block;margin-bottom:5px;} #yiv164665374 .yiv164665374attach label a { text-decoration:none;} #yiv164665374 blockquote { margin:0 0 0 4px;} #yiv164665374 .yiv164665374bold { font-family:Arial;font-size:13px;font-weight:700;} #yiv164665374 .yiv164665374bold a { text-decoration:none;} #yiv164665374 dd.yiv164665374last p a { font-family:Verdana;font-weight:700;} #yiv164665374 dd.yiv164665374last p span { margin-right:10px;font-family:Verdana;font-weight:700;} #yiv164665374 dd.yiv164665374last p span.yiv164665374yshortcuts { margin-right:0;} #yiv164665374 div.yiv164665374attach-table div div a { text-decoration:none;} #yiv164665374 div.yiv164665374attach-table { width:400px;} #yiv164665374 div.yiv164665374file-title a, #yiv164665374 div.yiv164665374file-title a:active, #yiv164665374 div.yiv164665374file-title a:hover, #yiv164665374 div.yiv164665374file-title a:visited { text-decoration:none;} #yiv164665374 div.yiv164665374photo-title a, #yiv164665374 div.yiv164665374photo-title a:active, #yiv164665374 div.yiv164665374photo-title a:hover, #yiv164665374 div.yiv164665374photo-title a:visited { text-decoration:none;} #yiv164665374 div#yiv164665374ygrp-mlmsg #yiv164665374ygrp-msg p a span.yiv164665374yshortcuts { font-family:Verdana;font-size:10px;font-weight:normal;} #yiv164665374 .yiv164665374green { color:#628c2a;} #yiv164665374 .yiv164665374MsoNormal { margin:0 0 0 0;} #yiv164665374 o { font-size:0;} #yiv164665374 #yiv164665374photos div { float:left;width:72px;} #yiv164665374 #yiv164665374photos div div { border:1px solid #666666;height:62px;overflow:hidden;width:62px;} #yiv164665374 #yiv164665374photos div label { color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;} #yiv164665374 #yiv164665374reco-category { font-size:77%;} #yiv164665374 #yiv164665374reco-desc { font-size:77%;} #yiv164665374 .yiv164665374replbq { margin:4px;} #yiv164665374 #yiv164665374ygrp-actbar div a:first-child { margin-right:2px;padding-right:5px;} #yiv164665374 #yiv164665374ygrp-mlmsg { font-size:13px;font-family:Arial, helvetica, clean, sans-serif;} #yiv164665374 #yiv164665374ygrp-mlmsg table { font-size:inherit;font:100%;} #yiv164665374 #yiv164665374ygrp-mlmsg select, #yiv164665374 input, #yiv164665374 textarea { font:99% Arial, Helvetica, clean, sans-serif;} #yiv164665374 #yiv164665374ygrp-mlmsg pre, #yiv164665374 code { font:115% monospace;} #yiv164665374 #yiv164665374ygrp-mlmsg * { line-height:1.22em;} #yiv164665374 #yiv164665374ygrp-mlmsg #yiv164665374logo { padding-bottom:10px;} #yiv164665374 #yiv164665374ygrp-mlmsg a { color:#1E66AE;} #yiv164665374 #yiv164665374ygrp-msg p a { font-family:Verdana;} #yiv164665374 #yiv164665374ygrp-msg p#yiv164665374attach-count span { color:#1E66AE;font-weight:700;} #yiv164665374 #yiv164665374ygrp-reco #yiv164665374reco-head { color:#ff7900;font-weight:700;} #yiv164665374 #yiv164665374ygrp-reco { margin-bottom:20px;padding:0px;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ov li a { font-size:130%;text-decoration:none;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ov li { font-size:77%;list-style-type:square;padding:6px 0;} #yiv164665374 #yiv164665374ygrp-sponsor #yiv164665374ov ul { margin:0;padding:0 0 0 8px;} #yiv164665374 #yiv164665374ygrp-text { font-family:Georgia;} #yiv164665374 #yiv164665374ygrp-text p { margin:0 0 1em 0;} #yiv164665374 #yiv164665374ygrp-text tt { font-size:120%;} #yiv164665374 #yiv164665374ygrp-vital ul li:last-child { border-right:none !important; } --> Sadhiq Wrote - Note system load and apache are not necessarily related. You may be running other processes in your scripts that are contributing to your load. This all depends on other config/cgi issues. Also note, if your dynamic sites are pulling from a database (ie mysql) with poor indexing or badly written queries this will also boost your system load, but has nothing to do with apache. Are if you running PHP as CGI or as an Apache module ? PHP as CGI is not a good thing to do, it will eat plenty of ressources. For each page request a new process is started. "use mod_fastcgi" Start servers won't cause a high load. Min with a small max can often do this by spawning and dropping processes to fast. Changing the max to a higher number and raising the MaxRequests will decrease the rate of forking/killing processes. so try increasing ur MaxRequests & reducing the Timeout value The other way work arnd try Limiting cpu with Rlimitcpu directive in apache This directive sets the soft and hard limits for maximum CPU usage of a process in seconds. It takes one or two parameters. The first parameter, soft-seconds, sets the soft resource limit for all processes. The second parameter, hard-seconds, sets the maximum resource limit. Either parameter can be a number, or ``max'', which indicates to the server that the limit should match the maximum allowed by the operating system configuration. Raising the maximum resource limit requires the server to be running as the user ``root'', or in the initial start-up phase. Ref - http://httpd.apache.org/docs/current/mod/core.html#rlimitcpu or u can limit cpu with cpulimit or prm Ref - http://www.cyberciti.biz/faq/cpu-usage-limiter-for-linux/ http://www.webhostgear.com/85.html If ur still stuck post ur conf & logs. Apache performance tuning http://httpd.apache.org/docs/2.0/misc/perf-tuning.html Or if ur caching doesnt increase try the following. Drop Caches Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. Now you can throw away that script that allocated a ton of memory just to get rid of the cache... To use /proc/sys/vm/drop_caches, just echo a number to it. To free pagecache: # echo 1 > /proc/sys/vm/drop_caches To free dentries and inodes: # echo 2 > /proc/sys/vm/drop_caches To free pagecache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable. If you run "sync" first to flush them out to disk, these drop operations will tend to free more memory. B.Sadhiq [Non-text portions of this message have been removed]