Tuesday, April 4, 2017

Swap space getting used



I am having a system with 8GB of RAM and running mysql on it ,top command shows



Mem: 8124416k total, 8110004k used, 14412k free, 21292k buffers
Swap: 8388600k total, 1712132k used, 6676468k free, 2058600k cached




vmstat 1 gives this output



 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
3 0 1712132 38596 21628 2033920 0 0 451 77 0 1 14 1 81 5 0
1 0 1712132 38412 21628 2033928 0 0 32 0 695 534 9 1 90 1 0
0 0 1712132 37992 21656 2034412 0 0 476 136 630 474 8 0 84 8 0
0 0 1712132 37992 21656 2034424 0 0 0 0 232 138 4 0 96 0 0
2 0 1712132 37540 21656 2034424 0 0 0 0 463 228 41 1 58 0 0
1 0 1712132 37480 21656 2034440 0 0 16 0 393 208 26 0 74 0 0

2 0 1712132 37932 21664 2034432 0 0 0 244 655 454 38 1 59 2 0
1 0 1712132 38056 21664 2034440 0 0 0 0 403 193 36 0 63 0 0
0 0 1712132 38056 21664 2034440 0 0 16 16 498 362 13 0 87 0 0
3 0 1712132 37872 21664 2034488 0 0 48 0 463 350 9 1 89 1 0
1 0 1712132 37996 21664 2034488 0 0 16 0 765 536 29 0 70 0 0
3 0 1712132 37996 21672 2034512 0 0 16 92 855 539 46 1 53 0 0
2 0 1712132 38432 21676 2034508 0 0 20 0 1015 545 63 1 36 0 0
0 0 1712132 38680 21684 2034544 0 0 0 72 540 307 34 0 66 0 0
6 0 1712132 38556 21684 2034544 0 0 0 0 926 518 80 1 20 0



0



free -m gives



             total       used       free     shared    buffers     cached
Mem: 7934 7910 23 0 21 1999
-/+ buffers/cache: 5889 2044
Swap: 8191 1672 6519



is the use of swap space a concern or is it normal and ok.



Thanks IN advance
Pankaj


Answer



The important column in your case isn't swpd but si and so. It's normal and healthy for Linux to swap unused stuff out. If, however, si and so showed constant activity, that would imply that you did not have adequate resources for your usage pattern. As others have pointed out, that would mean you had either a leaky app or just not enough RAM.



Frankly, I don't see anything disconcerting about the vmstat info you've posted.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...