Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #29425 - Configure default mongo cache size #492

Merged
merged 1 commit into from
Mar 30, 2020

Conversation

sthirugn
Copy link
Contributor

Configuring default mongo cache size to 20% of total memory. See[1]
Otherwise mongo goes onto consume about 50% of total memory. See[2]

[1] https://access.redhat.com/solutions/4505561
[2] https://docs.mongodb.com/manual/core/wiredtiger/#memory-use

@sthirugn
Copy link
Contributor Author

Local test passed, test procedure:

  1. vagrant up centos7-katello-3.15
  2. Apply the changes from this PR
  3. foreman-installer --scenario katello
  4. Review journalctl -f:
Mar 27 18:01:33 centos7-katello-3-15.apex.example.com mongod.27017[8441]: [initandlisten] options: { command: [ "run" ], config: "/etc/opt/rh/rh-mongodb34/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/opt/rh/rh-mongodb34/run/mongodb/mongod.pid" }, security: { authorization: "disabled" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true }, wiredTiger: { engineConfig: { cacheSizeGB: 1.13 } } }, systemLog: { destination: "syslog", quiet: true } }
  1. Note cacheSizeGB above - cacheSizeGB: 1.13
  2. check total memory in system facts
# facter -p memory | grep total_bytes
    total_bytes => 2147479552,
    total_bytes => 6087458816,  <-- this is the system memory info
  1. 20% of this 6087458816 × (20÷100) ÷ 1024 ÷1024 ÷1024 = 1.133877563 ~ 1.13 matches the above mongo configuration from Step 4.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good. I've always been wondering about doing this, but then in the postgresql department. We may even be able to drop some of the explicit tuning profile options then.

config/foreman-proxy-content.yaml Outdated Show resolved Hide resolved
Configuring default mongo cache size to 20% of total memory. See[1]
Otherwise mongo goes onto consume about 50% of total memory. See[2]

[1] https://access.redhat.com/solutions/4505561
[2] https://docs.mongodb.com/manual/core/wiredtiger/#memory-use
@@ -22,3 +22,6 @@ postgresql::server::config_entries:
log_line_prefix: '%t '
log_min_duration_statement: 1000
log_rotation_size: 200000

mongodb::server::config_data:
storage.wiredTiger.engineConfig.cacheSizeGB: "%{facts.kafo.scenario.custom.mongo_cache_size}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user hasn't upgraded to wiredTiger will this configuration option existing be a no-op for them? That is, will it break if not on wiredTiger?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it shouldn't. Let me see if I can get an older version of server to test this. It may be tricky to get one though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't get older versions of upstream / downstream boxes to get non-wiredTiger, is there a way to do it properly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found an old Satellite 6.3.5 server running mmapv1 and added the following to the custom-hiera.yaml and ran the installer. The mongo service came back up without any issues.

mongodb::server::config_data:
  storage.wiredTiger.engineConfig.cacheSizeGB: 2

@ehelms
Copy link
Member

ehelms commented Mar 27, 2020

Note, tests have not run yet. Travis is being flaky.

@ehelms ehelms merged commit f650f59 into theforeman:develop Mar 30, 2020
@sthirugn sthirugn deleted the mongo_cache_size branch March 30, 2020 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants