PDA

View Full Version : Serious apache issues how can I fix it???


desiguru
02-12-2007, 05:12 AM
It appears that apache is responding, however it is taking a significant amount of time to respond and load the website.

[root@serverx~]# top
top - 14:02:46 up 25 days, 23:02, 1 user, load average: 1.09, 0.41, 0.14
Tasks: 260 total, 2 running, 258 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.2% us, 34.9% sy, 57.9% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 1027556k total, 1019240k used, 8316k free, 3716k buffers
Swap: 2040244k total, 6964k used, 2033280k free, 413064k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26885 root 35 10 xxxx yyyy zzzz R 89.6 0.4 1:28.90 php
25154 nobody 15 0 2xxxx yyyy zzzz S 3.0 1.0 0:01.57 httpd
24136 nobody 15 0 2xxxx yyyy zzzz S 1.3 0.9 0:02.06 httpd
24161 nobody 15 0 2xxxx yyyy zzzz S 1.0 1.0 0:01.76 httpd
24044 nobody 15 0 2xxxx yyyy zzzz S 0.7 0.9 0:00.91 httpd
24777 nobody 15 0 2xxxx yyyy zzzz S 0.7 0.9 0:00.90 httpd
25244 nobody 15 0 2xxxx yyyy zzzz S 0.7 1.0 0:01.39 httpd
26959 root 17 0 3080 1068 760 R 0.7 0.1 0:00.20 top
40 root 15 0 0 0 0 S 0.3 0.0 5:22.19 kswapd0
29039 mysql 15 0 34736 21m 2260 S 0.3 2.1 1:03.41 mysqld
24012 nobody 15 0 2xxxx yyyy zzzz S 0.3 1.0 0:01.99 httpd
25548 nobody 15 0 1xxxx yyyy zzzz S 0.3 0.7 0:00.55 httpd
26916 root 16 0 xxxx yyyy zzzz S 0.3 0.2 0:00.11 sshd
1 root 16 0 2388 552 472 S 0.0 0.1 0:09.25 init
2 root 34 19 0 0 0 S 0.0 0.0 0:07.20 ksoftirqd/0
3 root 5 -10 0 0 0 S 0.0 0.0 0:00.19 events/0
4 root 6 -10 0 0 0 S 0.0 0.0 0:00.01 khelper
5 root 15 -10 0 0 0 S 0.0 0.0 0:00.00 kacpid
20 root 5 -10 0 0 0 S 0.0 0.0 0:00.05 kblockd/0
38 root 15 0 0 0 0 S 0.0 0.0 0:13.52 pdflush
41 root 9 -10 0 0 0 S 0.0 0.0 0:00.00 aio/0
21 root 15 0 0 0 0 S 0.0 0.0 0:00.00 khubd
187 root 25 0 0 0 0 S 0.0 0.0 0:00.00 kseriod
301 root 15 0 0 0 0 S 0.0 0.0 2:19.65 kjournald
1347 root 6 -10 1508 464 380 S 0.0 0.0 0:00.03 udevd


Load appears low, however memory usage appears to be at its limit:

After restart of apache:

[root@serverx~]# top
top - 14:07:31 up 25 days, 23:07, 1 user, load average: 0.39, 0.71, 0.36
Tasks: 205 total, 1 running, 204 sleeping, 0 stopped, 0 zombie
Cpu(s): 5.3% us, 3.3% sy, 0.0% ni, 89.4% id, 2.0% wa, 0.0% hi, 0.0% si
Mem: 1027556k total, 717624k used, 309932k free, 4296k buffers
Swap: 2040244k total, 1584k used, 2038660k free, 531552k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
27311 nobody 15 0 1xxxx yyyy zzzz S 1.0 0.7 0:00.09 httpd
27462 root 17 0 2584 1028 760 R 1.0 0.1 0:00.10 top
27481 nobody 15 0 1xxxx yyyy zzzz S 1.0 0.7 0:00.03 httpd
27482 nobody 15 0 1xxxx yyyy zzzz S 1.0 0.7 0:00.03 httpd
26916 root 16 0 xxxx yyyy zzzz S 0.7 0.2 0:00.17 sshd
27329 nobody 15 0 1xxxx yyyy zzzz S 0.7 0.7 0:00.25 httpd
27326 nobody 15 0 1xxxx yyyy zzzz S 0.3 0.6 0:00.14 httpd
27365 nobody 15 0 1xxxx yyyy zzzz S 0.3 0.7 0:00.04 httpd
27368 nobody 15 0 1xxxx yyyy zzzz S 0.3 0.7 0:00.14 httpd
27470 nobody 15 0 1xxxx yyyy zzzz S 0.3 0.7 0:00.05 httpd
1 root 16 0 2388 552 472 S 0.0 0.1 0:09.25 init
2 root 34 19 0 0 0 S 0.0 0.0 0:07.20 ksoftirqd/0
3 root 5 -10 0 0 0 S 0.0 0.0 0:00.19 events/0
4 root 6 -10 0 0 0 S 0.0 0.0 0:00.01 khelper
5 root 15 -10 0 0 0 S 0.0 0.0 0:00.00 kacpid
20 root 5 -10 0 0 0 S 0.0 0.0 0:00.05 kblockd/0
38 root 15 0 0 0 0 S 0.0 0.0 0:13.52 pdflush
41 root 9 -10 0 0 0 S 0.0 0.0 0:00.00 aio/0
21 root 15 0 0 0 0 S 0.0 0.0 0:00.00 khubd
40 root 15 0 0 0 0 S 0.0 0.0 5:22.25 kswapd0
187 root 25 0 0 0 0 S 0.0 0.0 0:00.00 kseriod
301 root 15 0 0 0 0 S 0.0 0.0 2:19.67 kjournald
1347 root 6 -10 1508 464 380 S 0.0 0.0 0:00.03 udevd
1792 root 6 -10 0 0 0 S 0.0 0.0 0:00.00 kauditd
1833 root 6 -10 0 0 0 S 0.0 0.0 0:00.00 kmirrord

Memory usage significantly drops.


Can someone please tell me how can I fix the memory usage please??

desiguru
02-12-2007, 05:15 AM
Just an addon to that... from my server monitoring service every 2-3 hours I get a messege saying

"

Notification Type: PROBLEM

Service: HTTP
Host: <USERID>
Address: 67.XX.XXX.X
State: CRITICAL

"

and after 15 minutes they send me an email

"
Notification Type: RECOVERY

Service: HTTP
Host: <USERID>
Address: 67.XX.XXX.X
State: OK

Date/Time: Sun Feb 11 17:48:05 CST 2007

Additional Info: HTTP ok: HTTP/1.1 200 OK - 0.006 second response time

"

Is there anything wrong with the control panel or the server???

Jeremy
02-12-2007, 11:59 AM
Its the server/apache.

Post the following.
CPU/OS/Kernel (uname -a)

The ram usage is fine and normal, its the swap that kills it your server but yours looks fine.

I would look at optimizing your httpd.conf
http://www.faqs.org/docs/securing/chap29sec245.html

desiguru
02-12-2007, 01:31 PM
I think I have optimized the httpd.conf enough. But I am posting it here anyways... look at the attachment.

Also I'm running RHEL 4 and I have 512MB of ram. Would this still be happening if I increase the RAM to 1 GB???

Or else how can I make sure that swap would not kill my apache?

desiguru
02-12-2007, 01:32 PM
Mem: 1027556k total, 1023792k used, 3764k free, 4824k buffers

This was the usage of memory at 11:32 am PST.

Jeremy
02-12-2007, 10:56 PM
Try

Timeout 60
KeepAliveTimeout 2

From your top it looks like you got a gig of ram in your server.

type
free -m

Your swap level looks fine

what kernel are you running?
uname -a

What mhz is the server?

desiguru
02-14-2007, 04:03 AM
It was a phpmyads logging slowing down the server. Since last two days everything looks normal.

Anywways, My kernel is:

Linux servername 2.6.9-42.0.3.EL #1 Mon Sep 25 17:14:19 EDT 2006 i686 i686 i386 GNU/Linux

When I typed free -m this is what showed up
total used free shared buffers cached
Mem: 1003 893 110 0 8 553
-/+ buffers/cache: 331 672
Swap: 1992 1 1990


Also I have 2.4 GHz processor.

Jeremy
02-14-2007, 07:39 AM
Ahh so you found the problem, i would see if theres any updates to that script then or look for a better one.

Yea you have a gig'ish..., not 512 Standard for webservers is 2gigs MySQL loves ram...

GL