[SERVER-28407] swap space consumption Created: 21/Mar/17  Updated: 31/May/17  Resolved: 21/Apr/17

Status: Closed
Project: Core Server
Component/s: WiredTiger
Affects Version/s: 3.2.11
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Luke Morfitt Assignee: Mark Agarunov
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2017-03-21 at 14.04.39.png    
Operating System: ALL
Participants:

 Description   

Hello,

Since upgrading to 3.2.x (maybe .10 or 11) we have seen mongo consuming swap space on our servers.

At the beginning of this graph is when we have restarted mongod freeing up the swap. Adding more swap provides a longer time period before we require restarting mongod. So far I have not found the upper limit to what mongod will consume. The max we have added is 8gb of swapfile.

             total       used       free     shared    buffers     cached
Mem:           59G        59G       444M       724K        27M        26G
-/+ buffers/cache:        32G        27G
Swap:         2.0G       1.8G       254M

Kind regards,
Luke



 Comments   
Comment by Kelsey Schubert [ 21/Apr/17 ]

Hi lukemorfitt,

We haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Thank you,
Thomas

Comment by Mark Agarunov [ 21/Mar/17 ]

Hello lukemorfitt,

Thank you for the report. The behavior you are seeing may be determined by the linux kernel, not the mongod process. On Linux, the kernel determines which memory gets swapped out, generally by swapping the least recently used blocks of memory. You may be able to tune how aggressively the kernel swaps out memory by adjusting the vm.swapiness sysctl.

If you are seeing the total memory usage (memory used + swap used) growing beyond what it should be using, this may be indicative of a memory leak. If this is the case, please do the following:

  • Start mongod with the additional flag --setParameter heapProfilingEnabled=true
  • Run mongod until reaching the high memory usage condition.
  • Archive and upload the $dbpath/diagnostic.data so that we can examine the data.
  • Provide the complete mongod logs while this issue is present.

I've created a secure upload portal so that you can send us the files.

Thanks,
Mark

Comment by Luke Morfitt [ 21/Mar/17 ]

Below is the breakdown of the mongod process specifically.

Process                                                         Mapped   Private    Shared  Resident      Swap
<SNIP>
/usr/bin/mongod                                                 39785M    39725M        0K 32483920K  1820488K

thanks,
Luke

Generated at Thu Feb 08 04:18:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.