[SERVER-29969] MongoDB 3.2 + WiredTiger uses swap when specified cache-size is enough Created: 04/Jul/17  Updated: 29/Jul/17  Resolved: 07/Jul/17

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

Type: Bug Priority: Major - P3
Reporter: rocky Assignee: Mark Agarunov
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

hi,
version: WiredTiger version :3.2.12
cache-size: --wiredTigerCacheSizeGB 12
data-size: Just have 1.3G
The following is mongostat result,

insert query update delete getmore command % dirty % used flushes vsize   res qr|qw ar|aw netIn netOut conn       set repl                      time
    *0    *0     *0     *0       0     3|0     0.0   22.4       0 3.56G 1.49G   0|0   0|0  427b  22.8k    3 spam_view  SEC 2017-07-04T11:35:12+08:00

PID=5668 - Swap used : 1.24G - (mongod )

The issue:
Mongd process use 1.2G SWAP, why mongod use so much swap while wiredTigerCacheSizeGB is enough and data path only 1.3G.



 Comments   
Comment by Mark Agarunov [ 07/Jul/17 ]

Hello 514154167@qq.com,

The ideal setting for swappiness depends on many variables that are specific to the system and setup, therefore I cannot provide a recommended value that would work best. However if you would like to reduce swap usage, setting it to a lower number, such as 10, observing how the system performs, and adjusting from there as needed is likely the best course of action. Note that swap being occupied by rarely accessed pages in not itself an issue unless you are seeing performance degradation due to this.

Please note that SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag. A question like this involving more discussion would be best posted on the mongodb-user group.

Thanks,
Mark

Comment by rocky [ 07/Jul/17 ]

hi Mark,
Thank you for your attention.
This issue may be due to the vm.swapiness value, I just start mongod according to "https://docs.mongodb.com/manual/administration/production-notes/ MongoDB and NUMA Hardware".
Now it is default 60, I will try modify vm.swapiness. Can you tell how to set vm.swapiness? Should be vm.swapiness = 1?

thanks

Comment by Mark Agarunov [ 05/Jul/17 ]

Hello 514154167@qq.com,

Thank you for the report. From your description of the issue, I believe this may be due to the vm.swapiness value of the Linux kernel swapping out pages that haven't been recently accessed. However, to get a better idea of what may be causing this, please archive and upload the $dbPath/diagnostic.data directory. This should give a bit more information as to what is causing this.

Thanks,
Mark

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