0

I run a Debian Linux server (with Apache 2 and MySQL) on a virtual private server with 256 MB memory. (I also use swapspace package.)

The system hanged.

The memory graph (provided by the hoster) showed that the used memory felt to almost zero (around 3 MB).

The CPU usage hit 100% at the same time.

I've rebooted the system and it works again.

What has happened?

porton
  • 312
  • 1
  • 14

1 Answers1

1

256MB is not much.

What do the logs say?

Without any kind of monitoring it will be hard to tell what happened in the past. If you expect the same thing to happen again keep running 'top' or 'vmstat 1' etc and watch the output while it happens.

Marki
  • 2,854
  • 3
  • 28
  • 45
  • Which logs to look into? Running `top` would be useless, because when the problem happens I could be unable to SSH connect to the hanged machine and so unable to see the output of `top` – porton Aug 10 '13 at 10:52
  • Yeah you can only ever see what's leading up to it. Unless there a console available of course. Even on a VPS they may have a (virtual) console. Logs generally are located in /var/log/. I'd look at the last few /var/log/messages*. But probably you won't see much more than the out-of-memory (oom) handler kicking in. If there's a DB running on there you should maybe optimize the DB server for the little RAM available. – Marki Aug 10 '13 at 10:59
  • `grep -ri "out of memory" /var/log` outputs nothing – porton Aug 10 '13 at 11:13
  • I'd really look at the complete logs instead of grepping something that may or may not be the case. – Marki Aug 10 '13 at 11:17
  • 1
    Running top is not useless. If you are running in a terminal session, the last top refresh before server crashing would give a lot of insight into what processes where using the most memory and CPU time. – inetplumber Aug 10 '13 at 13:07
  • 1
    Or you can log the output of top using a cron job to a log file(s). Something like top -b | head -n 20 > /var/log/top/`date +\%m.\%d.\%Y_\%H-\%M-\%S` will do you nicely. – inetplumber Aug 10 '13 at 13:14