Monitoring Swap Activity

As an administrator, you should be able to monitor swap activity. Just using the free command and seeing that some swap space is being used is not enough, because some processes can use swap space as a parking place for data that isn't needed immediately. In that case, you can allocate a lot of swap space without causing any harm. What's important to check is the activity of your swap space. To monitor that, you can use the vmstat command. In this command, the options si and so indicate swap activity; si refers to the number of blocks that were swapped in during the last polling interval, and so refers to the number of blocks that were swapped out during the last polling interval. If you see a high number here, then something is definitely wrong with the usage of swap on your server. If you see a low number or zero, you have no problem at all. When using vmstat, you should always run it a couple of times. For example, use vmstat 5 5 to run the command five times with a polling interval of five seconds. Check Listing 28-2 for an example.

Listing 28-2. Using vmstat to See Statistics About Swap Activity SFO:~ # vmstat 5 5

procs -

------memory---------- -

--swap

-- -

----io-

---

-system

■_cpu

----

r b

swpd free

buff cache

si

so

bi

bo

in

cs

us

sy id

wa

3 0

0

52048

72888 1317852

0

0

258

40

569

877

6

2 88

4

0 0

0

52080

72896 1317844

0

0

0

12

1044

2482

1

5 93

1

1 0

0

52096

72904 1317836

0

0

0

3

1251

5388

3

10 86

0

10

0

52096

72904 1317836

0

0

2

5

1105

5030

6

8 86

0

00

0

52112

72912 1317828

0

0

0

48

1060

6619

11

1080

0

Was this article helpful?

0 0

Post a comment