Advertisement
lyfsy

Strange swap usage

Jan 23rd, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. Strange swap usage
  2. Server strangely is swapping as under
  3. ++++++++++++++
  4. list of top cheapest host http://Listfreetop.pw
  5.  
  6. Top 200 best traffic exchange sites http://Listfreetop.pw
  7.  
  8. free link exchange sites list http://Listfreetop.pw
  9. list of top ptc sites
  10. list of top ptp sites
  11. Listfreetop.pw
  12. Listfreetop.pw
  13. +++++++++++++++
  14. Code:
  15. mysqld 216128 kBclamd 13556 kB
  16. spamd 4628 kB
  17. cpanel_php_fpm 2048 kB
  18. memcached 1804 kB
  19. java 1580 kB
  20. tuned 120 kB
  21. httpd 116 kB
  22. httpd 116 kB
  23. httpd 116 kB
  24. httpd 116 kB
  25. httpd 116 kB
  26. httpd 116 kB
  27. httpd 116 kB
  28. while RAM usage is
  29. Code:
  30. # free -h total used free shared buff/cache available
  31. Mem: 125G 34G 4.2G 150M 86G 80G
  32. Swap: 2.0G 238M 1.8G
  33. and swappiness is
  34. Code:
  35. # sysctl vm.swappiness
  36. vm.swappiness = 10
  37. This happens when cPanel backup are running, however 60sec data capture shows at no point did RAM availability drop...
  38. https://imge.to/i/vdAP1G
  39.  
  40. confused!
  41. Is it invoking the OOM killer (confirm via "dmesg") or is it just the kernel being egalitarian with how it maps file and anonymous pages in memory management? Unless you're having applications explicitly terminated by an emergency memory reclaim I wouldn't worry about it and let the experts that built Linux's memory management subsystem do its thing.
  42.  
  43. instantmasti.com
  44. dinstudio.com
  45. e host catt sadler
  46. ghost forum
  47. host global forum 2020
  48. master-ptp.com
  49. yllix.com
  50. profile.empowr.com
  51.  
  52. You have 80 GB of flex memory from that output.
  53.  
  54. Linux Ate My RAM and In defence of swap are good reads on this topic.
  55. Apis Networks: engineered hosting
  56. vm.swappiness = 10 is fine.
  57.  
  58. You can run the dynamic output of vmstat 1 on commadline, check 'swpd' utilization is high.
  59.  
  60. #vmstat 1 #
  61.  
  62. It is common to see that the SWAP memory is being used by few processes even if there is more than 30-50% of total physical memory is free, but it is something not to worry if the kernel is not triggering an 'OOM (Out of memory ) killer' on that specific time.
  63.  
  64. From the log file, you can see if any OOM errors are triggered
  65.  
  66. Run the following command on shell to see this.
  67.  
  68. # egrep -i "OOM" /var/log/messages*
  69.  
  70. The kernel migrates inactive pages into 'swap' in background, to free up the real RAM for more active data to be processed, when a heavy task is initiated. In similar conditions the kernel might occupy the SWAP space by skipping the available free RAM.
  71. TuxAndrew
  72. Linux - RedHat|cPANEL CentOS,Ubuntu |Azure-Vm/AWS-Ec2 Administrator,
  73. Assistance, Analysis and Diagnosis| Skype: tuxandrew
  74. tuxandrew@aol.com
  75. Also If we consider certain processes that was set with low memory limits, for those processes, the memory required might not be taken from the buffered, skip the free and taken from SWAP. May this can also explains what happened.
  76.  
  77.  
  78. Just quoting the typo:
  79. -----------------------------
  80. You can run the dynamic output of vmstat 1 on commadline, check 'swpd' utilization is high.
  81. Checked and it's all good. No OOM termination and now the swp usage is stationary.
  82.  
  83. Wonder if there is any downside to turn swap off all together?
  84. Not actually happen for systems with high amount of free memory available and must be pretty sure that the system will always maintain more than enough physical RAM. The Swap is a virtual memory extension. On production servers, it is not a practice to disable the swap memory permanently.
  85.  
  86. But clearing the swap temporarily is fine if the system has left with free memory() more than the SWAP.
  87. TuxAndrew
  88. Linux - RedHat|cPANEL CentOS,Ubuntu |Azure-Vm/AWS-Ec2 Administrator,
  89. Assistance, Analysis and Diagnosis| Skype: tuxandrew
  90. tuxandrew@aol.com
  91. Checked and it's all good. No OOM termination and now the swp usage is stationary.
  92.  
  93. Wonder if there is any downside to turn swap off all together?
  94. The downside: Your server will crash, or even if it doesn't your services will sometimes stop or be killed and be completely unable to start again.
  95.  
  96. Swap is a safety valve - it is there to permit your kernel to, literally, swap pages of RAM in and out of use. If it's not there and you run the box out of RAM (which will happen) then things die - and won't restart again because there won't be enough RAM available for them to run in. (MySQL I'm looking sternly your way, buddy)
  97.  
  98. tl;dr --
  99.  
  100. Having swap: Sometimes it'll be used and might slow things down.
  101. Not Having swap: Sometimes your server will explode messily
  102.  
  103. Choose!
  104. "I've seen spam you people wouldn't believe. Routers on fire off the OCs of AGIS. I watched MXes burning in the dark near the Cyberpromo Gateway. All those moments will be lost in time, like tears in rain. TTL=0."
  105. The downside: Your server will crash, or even if it doesn't your services will sometimes stop or be killed and be completely unable to start again.
  106.  
  107. Swap is a safety valve - it is there to permit your kernel to, literally, swap pages of RAM in and out of use. If it's not there and you run the box out of RAM (which will happen) then things die - and won't restart again because there won't be enough RAM available for them to run in. (MySQL I'm looking sternly your way, buddy)
  108.  
  109. tl;dr --
  110.  
  111. Having swap: Sometimes it'll be used and might slow things down.
  112. Not Having swap: Sometimes your server will explode messily
  113.  
  114. Choose!
  115. Wow! could you clarify if "you run the box out of RAM" is a given then it is also a given that your box will run out of RAM+Swap. So the server will "explode messily" anyway as you said. So server "explode messily" can probably be delayed and not mitigated by creating swap, unless slowness due to swap usage is your method of warning system for server "explode messily"!
  116.  
  117. We monitor RAM and Swap usage on 60 second intervals 24/7/365 with repeated alerts (email and sms) if the usage drosses 80% over a five min period. So unless we simply ignore the event alerts I don't see your downside happening. Adding swap just means clients complaining in addition to alerts, which if we don't act on alerts we probably won't act on client complaints (hope that never occurs).
  118. Wow! could you clarify if "you run the box out of RAM" is a given then it is also a given that your box will run out of RAM+Swap.
  119. Actually no.
  120.  
  121. Processes start up and claim $X amount of RAM for their own purposes - but might not again touch that particular page or five of RAM for seconds, hours, days even. (Think: daemons starting at server start-up loading shared libraries and etc)
  122.  
  123. Swap permits your kernel to recognize those claimed-but-not-used pages as exactly that and swap them out to disk. Still ready should they be needed by the process, but not consuming precious and finite RAM.
  124.  
  125. Quote Originally Posted by WindsOfChange View Post
  126. So the server will "explode messily" anyway as you said. So server "explode messily" can probably be delayed and not mitigated by creating swap, unless slowness due to swap usage is your method of warning system for server "explode messily"!
  127. Without swap you actually accelerate how quickly your server can get into a high memory contention state or even OOM entirely - because now all RAM allocations are equally important and the kernel has less flexibility in its memory management - the stuff that isn't in use has just as much claim to RAM as the stuff that needs to be in use.
  128.  
  129. Quote Originally Posted by WindsOfChange View Post
  130. Adding swap just means clients complaining in addition to alerts, which if we don't act on alerts we probably won't act on client complaints (hope that never occurs).
  131. Without swap space available your server is a ticking bomb - and when it goes off you will have no chance at all to get in and save it. With swap space, and the active monitoring of how much swap is being used, then when things do implode on you you'll have enough time, usually, to get in and salvage the situation before it's unrecoverable.
  132. "I've seen spam you people wouldn't believe. Routers on fire off the OCs of AGIS. I watched MXes burning in the dark near the Cyberpromo Gateway. All those moments will be lost in time, like tears in rain. TTL=0."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement