CentOS 5.2 LAMP server

The server slows down to a point where no services are responding. After a few minutes, it comes back and is running well. The server keeps doing this cycle, what could be wrong?

I have stopped the exim and proftpd services for now. I used the top command to see CPU usage but all was 0 even when the server stopped responding. I also had a Java tomcat service running which I have stopped as well but the problem still persists.

The logs aren't showing any signs of a dos/ddos.

Any ideas?

  • what dmesg is showing?? – B14D3 Mar 1 '11 at 13:46

A quick list of things to check:

  • Check top for the CPU usage, load, and memory usage. This should give you a good indication of what the problem is or isn't. If the load is very high you just have too much traffic for your server to handle. If you have high IO wait% you have too much disk activity. If you have no load/CPU usage at all then it will likely be some sort of application lock up.
  • In top check for applications using a lot of memory/cpu (M=sort by memory, P=sort by CPU usage), or at least more than they should. Check for locked-up applications by looking for a 'D' in the 'S' column.
  • Check top/free/vmstat for swap usage. It should be 0 or very low. If you are using swap you'll have to reconfigure your LAMP stack to use less memory.
  • Check netstat for any signs of DoS (for example).
  • Check system (/var/log/messages) and application logs (Apache, MySQL, etc...) for relevant error messages. If it is reoccuring every few minutes you may be able to see a pattern of error messages.
  • Check disk space via df -h and disk status with smartctl.
  • If all of that doesn't appear to show any issues it may be some sort of application issue or dead lock. Try enabling/adding debug logging to the app and see if you narrow down where the issue occurs.

Probably the best tool to check out in this case is sar. It should show you stats up to and including when the server freezes up. If you don't have it installed, it's part of the sysstat package.

How often is it doing this? Once a day, or every few hours? It sounds like it could be memory or disk I/O, but I'm not too sure.

  • Will have a look into the sysstat thanks. It's just started doing it about an hour ago and it keeps repeating the cycle of working fine, then offline for 2 or 3 mins, then up again. – user69904 Mar 1 '11 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.