[SERVER-34402] Abnormal Swap Usage Created: 10/Apr/18  Updated: 27/Oct/23  Resolved: 12/Apr/18

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

Type: Bug Priority: Major - P3
Reporter: MinwooLee Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File arbiter-diagnostic.data.tar.gz     File config-diagnostic.data.tar.gz    
Operating System: ALL
Participants:

 Description   

Hi,
I found an issue running mongodb on a single server.

Server has following specs:
8 Core
16GB RAM
4GB Swap

Server has following main application:
MySQL
MongoDB

Sufficient memory is available, but Swap usage remains at 100%.

$ free -m

              total        used        free      shared  buff/cache   available
Mem:          15726       11364         157          53        4204        3932
Swap:          4095        4095           0

$ ps -ef

mongod    6453     1  0  2017 ?        1-02:38:03 /usr/bin/mongod -f /etc/mongod-config.conf
mongod    6879     1  0  2017 ?        1-00:46:58 /usr/bin/mongod -f /etc/mongod-arbiter.conf

$ cat /proc/6453/status |grep -i vmswap

VmSwap:  3346268 kB

$ cat /proc/6879/status |grep -i vmswap

VmSwap:    30456 kB

I changed the swappiness setting, but it is the same.
$ sysctl vm.swappiness

vm.swappiness = 1

Is there a way to limit mongodb's swap usage?

+ Because I do not speak English well, you may feel my question is strange.



 Comments   
Comment by Bruce Lucas (Inactive) [ 12/Apr/18 ]

Hi Minwoo,

Thank you for providing the data. It shows that the two mongod processes are using memory as follows:

virtual  5,315 MiB
resident 1,648 MiB
 
virtual    498 MiB
resident    17 MiB

The difference between virtual and resident is consistent with the numbers you provided that one of the mongod processes is using about 3.5 GB of swap.

The metrics also show that the total "anonymous" memory usage across the system is 11,246 MiB; this is memory used for heap and stacks by all processes in the system. This is much larger than the total amount used by the two mongod processes, so that means some process other than mongod is using a large amount of memory, and that is what is causing the mongod process to be swapped out.

Since there is no indication of a memory usage issue by mongod, I'll close this ticket out.

Bruce

Comment by MinwooLee [ 11/Apr/18 ]

Hi, Bruce Lucas

I uploaded my mongodb diagnostic.data for April(4/1~4/10 KST).
I compressed the diagnostic.data and uploaded it directly to the issue .

Thanks.

Comment by Bruce Lucas (Inactive) [ 10/Apr/18 ]

Hi MinwooLee,

Can you please archive and upload the content of the diagnostic.data directory in the dbpath of each of your mongod instances? These files may be too large to attach to this ticket, so you can use this upload portal. This will give us a clearer picture of the memory usage of the mongod processes.

Thanks,
Bruce

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