Managing swap space on Linux systems

By  

If you see them, you're already collecting performance data and can examine the last week's worth of performance data with sar.

# ls -l /var/log/sa
total 24880
-rw-r--r-- 1 root root 1530096 Jun  9 23:50 sa09
-rw-r--r-- 1 root root 1530096 Jun 10 23:50 sa10
-rw-r--r-- 1 root root 1530096 Jun 11 23:50 sa11
-rw-r--r-- 1 root root 1530096 Jun 12 23:50 sa12
-rw-r--r-- 1 root root 1530096 Jun 13 23:50 sa13
-rw-r--r-- 1 root root 1519936 Jun 14 23:50 sa14
-rw-r--r-- 1 root root 1530096 Jun 15 23:50 sa15
-rw-r--r-- 1 root root 1530096 Jun 16 23:50 sa16
-rw-r--r-- 1 root root 1338864 Jun 17 20:50 sa17
-rw-r--r-- 1 root root 1475429 Jun  9 23:53 sar09
-rw-r--r-- 1 root root 1475429 Jun 10 23:53 sar10
-rw-r--r-- 1 root root 1475429 Jun 11 23:53 sar11
-rw-r--r-- 1 root root 1475429 Jun 12 23:53 sar12
-rw-r--r-- 1 root root 1475429 Jun 13 23:53 sar13
-rw-r--r-- 1 root root 1466623 Jun 14 23:53 sar14
-rw-r--r-- 1 root root 1475429 Jun 15 23:53 sar15
-rw-r--r-- 1 root root 1475429 Jun 16 23:53 sar16

You can view some of the stats collected since the beginning of the day just by typing sar. The default view will show you information on CPU stats. The lines below show this system is idle nearly all the time.

# sar
Linux 2.6.18-128.el5 (boson)     06/17/2012

12:00:01 AM       CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM       all      0.57      0.00      0.09      0.21      0.00     99.13
12:20:01 AM       all      0.08      0.00      0.04      0.01      0.00     99.87
...

Memory and swap space utilization measurements are available with sar's -r option. If the numbers look like this, you're in great shape. This system isn't using its swap space at all.

# sar -r | head -6
Linux 2.6.18-128.el5 (boson)     06/17/2012

12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached kbswpfree kbswpused  %swpused  kbswpcad
12:10:01 AM  24071880  12965924     35.01    272816  10711820  16777208         0     0.00         0
12:20:01 AM  24086544  12951260     34.97    272912  10712384  16777208         0     0.00         0
12:30:01 AM  24106628  12931176     34.91    272980  10714716  16777208         0     0.00         0

If, on the other hand, the swap measurements look like this, your system is hurting.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

IT ManagementWhite Papers & Webcasts

See more White Papers | Webcasts

Answers - Powered by ITworld

ITworld Answers helps you solve problems and share expertise. Ask a question or take a crack at answering the new questions below.

Ask a Question