Troubleshooting common Apache HTTPD problems

Check your error_log

* The first place to look
* Increase the LogLevel if needed
* Make sure to turn it back down (but not off) in production

Check System Health

* vmstat, systat, iostat, mpstat, lockstat, etc…
* Check interrupt load
o NIC might be overloaded
* Are you swapping memory?
o A web server should never swap
* Check system logs
o /var/log/message, /var/log/syslog, etc…

Check Apache Health

* server-status
o ExtendedStatus
* Verify “httpd -V”
* ps -elf | grep httpd | wc -l
o How many httpd processes are running?

server-status Example

Other Possibilities

* Set up a staging environment
* Set up duplicate hardware
* Check for known bugs
o http://nagoya.apache.org/bugzilla/

Common Bottlenecks

* No more File Descriptors
* Sockets stuck in TIME_WAIT
* High Memory Use (swapping)
* CPU Overload
* Interrupt (IRQ) Overload

File Descriptors

* Symptoms
o entry in error_log
o new httpd children fail to start
o fork() failing across the system
* Solutions
o Increase system-wide limits
o Increase ulimit settings in apachectl

TIME_WAIT

* Symptoms
o Unable to accept new connections
o CPU under-utilized, httpd processes sit idle
o Not Swapping
o netstat shows huge numbers of sockets in TIME_WAIT

* Many TIME_WAIT are to be expected
* Only when new connections are failing is it a problem
o Decrease system-wide TCP/IP FIN timeout

Memory Overload, Swapping

* Symptoms
o Ignore system free memory, it is misleading!
o Lots of Disk Activity
o top/free show high swap usage
o Load gradually increasing
o ps shows processes blocking on Disk I/O

* Solutions
o Add more memory
o Use less dynamic content, cache as much as possible
o Try the Worker MPM

How much free memory
do I really have?

* Output from top/free is misleading.
* Kernels use buffers
* File I/O uses cache
* Programs share memory
o Explicit shared memory
o Copy-On-Write after fork()
* The only time you can be sure is when it starts swapping.

CPU Overload

* Symptoms
o top shows little or no idle CPU time
o System is not Swapping
o High system load
o System feels sluggish
o Much of the CPU time is spent in userspace

* Solutions
o Add another CPU, get a faster machine
o Use less dynamic content, cache as much as possible

Interrupt (IRQ) Overload

* Symptoms
o Frequent on big machines (8-CPUs and above)
o Not Swapping
o One or two CPUs are busy, the rest are idle
o Low overall system load

* Solutions
o Add another NIC
+ bind it to the first or use two IP addresses in Apache
+ put NICs on different PCI busses if possible

Share and Enjoy:
  • Digg
  • Mixx
  • del.icio.us
  • StumbleUpon
  • Facebook
  • TwitThis
  • Technorati
  • Google

Tags:

One Response to “Troubleshooting common Apache HTTPD problems”

  1. Herniated Lumbar Disk Says:

    I have been dealing with lower back problems for sometime now. My doctor gave me 3 epidural shots and pain medication for treatment…along with physical therapy.

Leave a Reply