3
0

OP#179 add service control units for memory consumption

This commit is contained in:
2025-12-03 12:24:44 +01:00
parent c1f8eb8adf
commit 1c95467582
4 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View File

@@ -2,3 +2,4 @@
Gemfile.lock Gemfile.lock
FileList FileList
.scannerwork .scannerwork
.vscode

View File

@@ -1,6 +1,8 @@
{ {
"cSpell.words": [ "cSpell.words": [
"changeme", "changeme",
"GOMAXPROCS",
"procs",
"reqpackage", "reqpackage",
"rpms", "rpms",
"sslcacert", "sslcacert",

View File

@@ -17,6 +17,11 @@
# @param [String] ps_retention_time tsdb retention time # @param [String] ps_retention_time tsdb retention time
# @param [String] ps_retention_size tsdb retention size # @param [String] ps_retention_size tsdb retention size
# @param [String] ps_wal_seg_size WAL segment size # @param [String] ps_wal_seg_size WAL segment size
# @param [String] ps_max_mem hard memory ceiling
# @param [String] ps_high_mem soft limit to make kernel reclaim earlier
# @param [String] ps_swap_mem allow swap, but limit it
# @param [String] ps_oom_score OOM killer choosing prometheus
# @param [String] ps_max_procs reduce parallel WAL replay workers
############################################################################## ##############################################################################
class prometheus_cd::params ( class prometheus_cd::params (
@@ -45,6 +50,13 @@ class prometheus_cd::params (
String $ps_retention_size = '20GB', String $ps_retention_size = '20GB',
String $ps_wal_seg_size = '50MB', String $ps_wal_seg_size = '50MB',
# service
String $ps_max_mem = '6G',
String $ps_high_mem = '5G',
String $ps_swap_mem = '4G',
String $ps_oom_score = '500',
String $ps_max_procs = '1',
) { ) {
# defaults # defaults
$fqdn = $facts['networking']['fqdn'] $fqdn = $facts['networking']['fqdn']

View File

@@ -2,6 +2,12 @@
##### File created by Puppet - manual changes will be overwritten ##### ##### File created by Puppet - manual changes will be overwritten #####
############################################################################### ###############################################################################
[Service] [Service]
MemoryMax=<%= @ps_max_mem %>
MemoryHigh=<%= @ps_high_mem %>
MemorySwapMax=<%= @ps_swap_mem %>
OOMScoreAdjust=<%= @ps_oom_score %>
Environment="GOMAXPROCS=<%= @ps_max_procs %>"
ExecStart= ExecStart=
ExecStart=/usr/bin/prometheus \ ExecStart=/usr/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yml \ --config.file=/etc/prometheus/prometheus.yml \