Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Introduction
My server is running on Debian and I think that two days ago it was out of memory, because it was getting really slow. Everytime a little bit slower. Two times in a row it somehow started to respond again at 0.00 AM.

So my question is
Does Debian clear it's memory on 0.00 AM? Or is it something else than the memory? And how can I easily solve this? By increasing the swap?

share|improve this question
    
see log file(/var/log/syslog) –  ooshro Mar 1 '11 at 9:04
    
@ooshro: The log file only contains information about today. –  Z0q Mar 1 '11 at 9:11
    
@Z0q -- /var/log/syslog.[1,2,3...] is your previous days logs. –  Coops Mar 1 '11 at 9:29
add comment

3 Answers

Install sysstat (if it's not already installed). This gives historic stats of system resources.

You can then run sar -r to see memory usage at five minute intervals. Scroll back to around the time you mention, and actually see the figures involved.

share|improve this answer
add comment

To add to the other answers:

Look in /etc/crontab and in the folder /etc/cron.d for any cron jobs that run around that time. (See man cron for how this file works). There are other folders (cron./monthly/weekly/dailyhourly) that contain jobs that are run at those intervals, but likely only cron.hourly will have anything that will run at midnight, and that's usually empty on standard Debian configurations.

Another possibility is that the midnight thing is a coincidence, and Debian is running so low on memory that the kernel has invoked the oom_killer (Link), whereby it tries to keep itself alive by killing processes, based on a scoring system. However, if this were the case, you'd probably have noticed your services not running. dmesg will log any points at which the oom_killer was invoked since you booted the OS. (/var/log/kern.log will have older ones)

To be clear, though. There's nothing inherent in Debian (or any Linux) that can clear memory. RAM is either free, where Linux will typically use it as a cache for the filesystem until something requires it, or allocated to a process.

share|improve this answer
add comment

have you used top or htop? There you can see what happen.

Look before 0.00AM and then after them ;). Then you can see if there something clean your memory. But i don't think so perhaps its cleaning his cache but he cache only files when he has enough RAM.

When your server run into the swap you need more RAM or less running processes.

share|improve this answer
    
What does top or htop mean? I'm new to Debian. –  Z0q Mar 1 '11 at 9:08
    
hmm top is a commendline program to show you RAM. htop is the better solution but this is in the repot "apt-get install htop" there you have a better view over your CPU and RAM. –  Stony Mar 1 '11 at 9:17
    
Thanks for the suggestion of top and htop. It is working perfectly! –  Z0q Mar 1 '11 at 9:28
    
@Z0q something tells me if you don't know the "top" command perhaps Debian isn't the best Linux distribution for you to run. You may perhaps need something a little less intimidating. –  Coops Mar 1 '11 at 9:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.