[SERVER-22274] WiredTiger cache size is only configurable in whole gigabytes. Created: 22/Jan/16  Updated: 21/Nov/16  Resolved: 25/Jan/16

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

Type: Bug Priority: Minor - P4
Reporter: Jeroen Vijfhuizen Assignee: Kelsey Schubert
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-27131 While inserting records into MongoDB,... Closed
Operating System: ALL
Participants:

 Description   

Hello, on our development servers we currently run our application server alongside a standalone mongod instance. Ever since WiredTiger was introduced we have the occasional OOM killer issue where app server RAM + WT cache + file system buffers are way higher than these smaller instances have.

I was looking into overriding the WT cache size into something smaller and found this option:
https://docs.mongodb.org/manual/reference/configuration-options/#storage.wiredTiger.engineConfig.cacheSizeGB

The problem is that this only allows this value to be specified in whole gigabytes while total RAM of these instances is only 1 or 2 Gb. Specifying this value as a fraction results in parse errors as this field is parsed as an integer. I also tried other key names such as 'cacheSizeMB' or 'cacheSize' without any luck. I also tried using a letter as in indicator ('200M') but that leads to another parsing error.

I found a workaround in this post but that does not seem to work (anymore?):
https://groups.google.com/forum/#!topic/mongodb-user/GLrp-H31YWg

Are there plans to specify this value in a more specific way. Also, is there a current workaround for this?



 Comments   
Comment by Ramon Fernandez Marina [ 28/Jan/16 ]

jeroen.vijfhuizen@exmachinagames.com, this works for me, please give it a try:

storage:
 wiredTiger:
  engineConfig:
    configString : cache_size=345M

Comment by Jeroen Vijfhuizen [ 28/Jan/16 ]

Hi Thomas,

thanks for checking the workaround. You were right, when specifying it directly on the commandline it works. I'm having issues with double quoting when sourcing this variable from /etc/default/mongod (don't want to change the upstart file with these sort of settings if I can help it) so I'll get this working on way or another.

I'm curious though, are there plans to fix this issue? My bug report was not about the workaround but about the fact that this value is not configurable over what I assume to be the preferred method, the config file. Even with this workaround working I have configuration spread out over multiple places.

Thanks!

Regards,
Jeroen Vijfhuizen

Comment by Kelsey Schubert [ 25/Jan/16 ]

Hi jeroenv,

The workaround you have have linked appears to be working using MongoDB 3.0.8.

I started the mongod with the following command:

mongod --dbpath /a/path/to/db --logpath /a/path/to/log --storageEngine wiredTiger --wiredTigerEngineConfigString="cache_size=200M" --fork

In the log, I saw the option was set (ignore the first instance of cache_size):

2016-01-25T12:34:26.022-0500 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=8G,session_max=20000,
eviction=(threads_max=4),statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),
file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),cache_size=200M

Additionally, I opened the shell and executed

 db.serverStatus().wiredTiger.cache 

and observed that the correct number of maximum bytes were configured.

"maximum bytes configured" : 209715200,

If you start mongod with the same command and see a different results please comment and we will reopen ticket.

Thank you,
Thomas

Generated at Thu Feb 08 03:59:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.