Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Restrict mongodb memory usage
Browse files Browse the repository at this point in the history
Currently, mongodb has no limits on how much memory
it can consume. This enforces restriction so mongodb
service limits through systemd.

The puppet-systemd module has support for limits. The
MemoryLimit support is added in the follwoing pull
request voxpupuli/puppet-systemd#23

Closes-bug: #1656558

Change-Id: Ie9391aa39532507c5de8dd668a70d5b66e17c891
  • Loading branch information
pkilambi committed Apr 3, 2017
1 parent e292871 commit 3aa86a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions manifests/profile/base/database/mongodb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@
# for more details.
# Defaults to hiera('step')
#
# [*memory_limit*]
# (Optional) Limit amount of memory mongodb can use
# Defaults to 20G
#
class tripleo::profile::base::database::mongodb (
$mongodb_replset,
$bootstrap_node = downcase(hiera('bootstrap_nodeid')),
$step = hiera('step'),
$memory_limit = '20G',
) {
if $step >= 2 {

Expand All @@ -56,5 +61,11 @@
}
}

# Limit memory utilization
::systemd::service_limits { 'mongod.service':
limits => {
'MemoryLimit' => $memory_limit
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- Add a way for mongodb to limit amount of memory it comsumes
with systemd. A new param memory_limit has been added to
tripleo::profile::base::database::mongodb class with
default limit of 20G.

0 comments on commit 3aa86a4

Please sign in to comment.