LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How much swap usage is too much? (https://www.linuxquestions.org/questions/linux-hardware-18/how-much-swap-usage-is-too-much-506316/)

sneakyimp 11-30-2006 03:32 PM

How much swap usage is too much?
 
I upgraded my server to 768 MB of RAM from 512 a while back and it really helped performance. I recently checked the memory usage with 'free' and the swap file seems to be creeping up again. How much swap usage is too much?

Code:

[root@myDOMAIN root]# free
            total      used      free    shared    buffers    cached
Mem:        765520    738536      26984          0      96092    319552
-/+ buffers/cache:    322892    442628
Swap:      1052248    103112    949136


macemoneta 11-30-2006 03:48 PM

The free display says that (minus buffers and cache) you have 442628k free memory, while you are using 103112k of swap. In other words, you could turn off swap and still have plenty of free memory. When this equation results in a less than zero value, you are using too much swap (you need more memory).

The usage of swap is generally a good thing - memory that is not used is moved out of RAM, making more available to the system/applications. Swap only becomes a problem if pages are moving in/out rapidly, which only occurs if there is too little RAM (a condition called thrashing). When thrashing, the system will slow to a crawl. If you're not experiencing that problem, your swap usage is OK.

sneakyimp 11-30-2006 03:56 PM

THANKS.

At the moment, my server is not thrashing. Performance is fine. However, Nov 9 - 14th it experienced a HUGE surge in traffic. I'm wondering if there's any way in retrospect to determine if it was slow during the surge.

macemoneta 11-30-2006 04:48 PM

Well, if you are running any servers that limit their operation based on load level (like sendmail), your historical logs (/var/log/mail/maillog* in the case of sendmail) will show messages from the servers delineating the period(s). Aside from that, unless you are recording the data yourself, there's no historical information normally kept by the system.


All times are GMT -5. The time now is 02:04 AM.