We help IT Professionals succeed at work.

swap question and free buffers

peter
peter asked
on
269 Views
Last Modified: 2014-11-21
I was wondering why would RHEL use swap , when there are Free buffers (shown in free command)
In our case when we see free memory in top command getting exhausted, The server is using SWAP even though I see the Free buffers.

top - 16:57:41 up 26 days, 15:44,  3 users,  load average: 1.28, 1.91, 2.20
Tasks: 1477 total,   1 running, 1474 sleeping,   0 stopped,   2 zombie
Cpu(s):  0.2%us,  1.5%sy,  0.0%ni, 93.3%id,  5.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  126011368k total, 120899848k used,  5111520k free,     1216k buffers
Swap: 781411152k total, 14705180k used, 766705972k free, 42577308k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
   181 root      20   0     0    0    0 D 20.4  0.0   2959:04 kswapd0
101309 oracle    20   0 16192 2168  664 S  1.3  0.0   0:29.11 top
 58546 oracle    20   0 50.2g 3.9g 3.8g S  1.0  3.2   9:39.78 oracle
108427 xxx-user  20   0 16104 2420 1000 R  1.0  0.0   0:00.16 top
    73 root      20   0     0    0    0 S  0.3  0.0   4:36.71 events/6
  2589 root      20   0  195m 2600 1140 S  0.3  0.0 128:49.36 snmpd
 34482 oracle    20   0 50.2g  89m  80m S  0.3  0.1  42:57.32 oracle
 34488 oracle    20   0 50.2g  14g  14g S  0.3 11.8  29:04.97 oracle
 34490 oracle    20   0 50.2g  14g  14g S  0.3 11.7  28:52.22 oracle
 34492 oracle    20   0 50.2g  14g  14g S  0.3 11.8  29:13.85 oracle
 34494 oracle    20   0 50.2g  13g  13g S  0.3 11.5  28:47.19 oracle
 45764 oracle    20   0 50.2g 3.1g 3.1g S  0.3  2.5   2:45.73 oracle
 89881 oracle    20   0 50.3g  12g  12g S  0.3 10.1  56:44.77 oracle
112926 oracle    20   0 50.3g 3.5g 3.5g S  0.3  2.9   5:27.46 oracle
Comment
Watch Question

Seth SimmonsLead Systems Administrator
CERTIFIED EXPERT

Commented:
by default, the kernel will swap out unused memory pages
there is a setting called swappiness; the default is 60
you can verify by doing cat /proc/sys/vm/swappiness
you can change it by doing echo 0 > /proc/sys/vm/swappiness which will cause the system to keep more in physical memory.  this is actually a recommended setting by oracle which i have used in the past
to make it permanent, add a line vm.swappiness = 0 to /etc/sysctl.conf

what version of RHEL?  your swap partition seems huge; should really need much
little to no swap usage is ideal in a system like that.  you can use vmstat to monitor the realtime usage
columns si and so (swap in and swap out) you want to pay attention to.  if these are constantly non-zero then you have a bottleneck that could affect oracle performance
peterDevOps Engineer

Author

Commented:
thanks Seth,
we are using RHEL 6.5, Can this be because we are not using hugepages?
we recently disabled THP

#SWAP
vm.swappiness = 15 <<<<<this was originally 0
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10  <<<<<this was originally 80
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
[root@EGS-ORACLEPROD-01 ec2-user]#

 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 st
 3  1 12084124 1208464    788 45135084   33   21  1678   748    0    0 11  4 82  3  0
 3  2 12073976 1192172    888 45144792 2070  211 61896 47374 26706 17685 15  6 73  6  0
 6  0 12075904 1580260    772 45144320 3427 3968 15995 24783 30457 21892 12  8 73  7  0
 9  2 12067204 1657068   1032 45157736 1745   63 12306  9830 31609 24469 12  9 73  6  0
 3  0 12072836 1719692   1064 45143564 1380 2388  5535 15386 29756 22788  9 10 76  5  0
Lead Systems Administrator
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
peterDevOps Engineer

Author

Commented:
ok, we did that,

I am setting hugepages to

vm.nr_hugepages = 25604

per this helpful article, lets see what happens : )
https://docs.oracle.com/cd/E11882_01/server.112/e10839/appi_vlm.htm#UNXAR396

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.