I'm experiencing an issue when sometimes the memory gets 100% full, and the swap file also, and the server becomes non-responsive and has to be restarted (causing also problems in database). This is what Cacti shows:

Physical Memory Swap File

The server is running a web-app (database + apache) and during that specific moment didn't experience any ir-regular traffic or usage. This scenario happened twice in the last week. What can cause this? How can I resolve the issue?

  • I would suggest you have a cron job send you outputs of ps aux, cat /proc/slabinfo etc. every minute or so, either to an email address or to sync-mounted storage. This should make it easy to see what process ran amuck after a crash. If you want to gain time, it might help to increase swap space (you can use a regular file as swap too, just loopback mount it!). – rackandboneman Jan 10 '13 at 10:27
  • 2
    @rackandboneman: Loopback mount swap file? Aieee! Don't do that. Just dd if=/dev/zero of=/path/to/your/swapfile bs=1024 count=1048576 or so and then mkswap /path/to/your/yourswapfile. Then swapon /path/to/your/swapfile should work. – Janne Pikkarainen Jan 10 '13 at 10:33
  • If it works, all the better - I did not want to assume it will work on every linux system the TO could have (no version info given), since as per the docs a device file is expected for swapon. – rackandboneman Jan 10 '13 at 10:39
  • If you can log in interactively, you could also run top (press shift-m once it's running to sort processes by memory consumption). When the server stops responding, the top display will freeze, so you can examine it at your leisure. – Ansgar Esztermann Jan 10 '13 at 10:45

you can clear a cache of linux machine and pu it into a crontab entry to run in regular interval.

| improve this answer | |
  • 1
    How would you do this? Can you add that to your answer? – slm Jun 26 '13 at 22:33

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.