From 6298faf242336cb118580e3691dc9c619c3f5979 Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Mon, 28 Dec 2020 01:46:22 +0900 Subject: [PATCH] Adjust memory_hard_limit References: https://www.nomadproject.io/docs/drivers/docker#memory_hard_limit https://github.com/hashicorp/nomad/pull/8087 https://github.com/femiwiki/femiwiki/issues/116#issuecomment-751487392 (cherry picked from commit cc93e5129b8140881e8748805d17691b360c1f0c) --- nomad/development.nomad | 52 ++++++++++++++++++++++----------------- nomad/production.nomad | 54 ++++++++++++++++++++++++----------------- 2 files changed, 62 insertions(+), 44 deletions(-) diff --git a/nomad/development.nomad b/nomad/development.nomad index 030ee1f5..fdb50ff1 100644 --- a/nomad/development.nomad +++ b/nomad/development.nomad @@ -34,6 +34,12 @@ job "mediawiki" { volumes = [ "local/Caddyfile:/srv/femiwiki.com/Caddyfile" ] + + memory_hard_limit = 400 + } + + resources { + memory = 80 } template { @@ -66,10 +72,6 @@ EOF destination = "local/Caddyfile" } - - resources { - memory = 256 - } } network { @@ -120,6 +122,11 @@ EOF config { image = "ghcr.io/femiwiki/mediawiki:latest" + memory_hard_limit = 600 + } + + resources { + memory = 80 } volume_mount { @@ -127,10 +134,6 @@ EOF destination = "/a" read_only = true } - - resources { - memory = 256 - } } network { @@ -176,6 +179,11 @@ EOF config { image = "mysql:8.0" args = ["--default-authentication-plugin=mysql_native_password"] + memory_hard_limit = 1000 + } + + resources { + memory = 500 } env { @@ -184,10 +192,6 @@ EOF MYSQL_USER = "DB_USERNAME" // secret.php.example에 적힌 기본값 MYSQL_PASSWORD = "DB_PASSWORD" // secret.php.example에 적힌 기본값 } - - resources { - memory = 1024 - } } network { @@ -210,10 +214,11 @@ EOF config { image = "memcached:1-alpine" + memory_hard_limit = 240 } resources { - memory = 256 + memory = 60 } } @@ -237,6 +242,11 @@ EOF config { image = "ghcr.io/femiwiki/parsoid:2020-09-05T10-03-ae442600" + memory_hard_limit = 400 + } + + resources { + memory = 120 } env { @@ -245,10 +255,6 @@ EOF # Avoid using NOMAD_UPSTREAM_ADDR_http https://github.com/femiwiki/nomad/issues/1 MEDIAWIKI_APIS_URI = "http://localhost/api.php" } - - resources { - memory = 1024 - } } network { @@ -278,6 +284,11 @@ EOF config { image = "ghcr.io/femiwiki/restbase:2020-09-05T10-04-5dcdc8b6" + memory_hard_limit = 400 + } + + resources { + memory = 100 } env { @@ -287,10 +298,6 @@ EOF PARSOID_URI = "http://${NOMAD_UPSTREAM_ADDR_parsoid}" MATHOID_URI = "http://${NOMAD_UPSTREAM_ADDR_mathoid}" } - - resources { - memory = 1024 - } } network { @@ -331,10 +338,11 @@ EOF config { image = "wikimedia/mathoid:bad5ec8d4" + memory_hard_limit = 600 } resources { - memory = 1024 + memory = 150 } } diff --git a/nomad/production.nomad b/nomad/production.nomad index b1dbca13..ede19b22 100644 --- a/nomad/production.nomad +++ b/nomad/production.nomad @@ -34,6 +34,12 @@ job "mediawiki" { readonly = false } ] + + memory_hard_limit = 400 + } + + resources { + memory = 80 } artifact { @@ -46,10 +52,6 @@ job "mediawiki" { FASTCGI_ADDR = "${NOMAD_UPSTREAM_ADDR_fastcgi}" RESTBASE_ADDR = "${NOMAD_UPSTREAM_ADDR_restbase}" } - - resources { - memory = 32 - } } network { @@ -132,6 +134,12 @@ job "mediawiki" { readonly = false } ] + + memory_hard_limit = 600 + } + + resources { + memory = 80 } artifact { @@ -151,10 +159,6 @@ job "mediawiki" { destination = "/a/secret.php" read_only = true } - - resources { - memory = 110 - } } network { @@ -217,6 +221,11 @@ job "mediawiki" { "--default-authentication-plugin=mysql_native_password", "--datadir", "/srv/mysql" ] + memory_hard_limit = 1000 + } + + resources { + memory = 500 } volume_mount { @@ -234,10 +243,6 @@ job "mediawiki" { env { MYSQL_RANDOM_ROOT_PASSWORD = "yes" } - - resources { - memory = 512 - } } network { @@ -266,10 +271,11 @@ job "mediawiki" { config { image = "memcached:1.6.6-alpine" + memory_hard_limit = 240 } resources { - memory = 80 + memory = 60 } } @@ -299,6 +305,11 @@ job "mediawiki" { config { image = "ghcr.io/femiwiki/parsoid:2020-09-05T10-03-ae442600" + memory_hard_limit = 400 + } + + resources { + memory = 120 } env { @@ -307,10 +318,6 @@ job "mediawiki" { # Avoid using NOMAD_UPSTREAM_ADDR_http https://github.com/femiwiki/nomad/issues/1 MEDIAWIKI_APIS_URI = "http://localhost/api.php" } - - resources { - memory = 150 - } } network { @@ -355,6 +362,12 @@ job "mediawiki" { readonly = false } ] + + memory_hard_limit = 400 + } + + resources { + memory = 100 } env { @@ -364,10 +377,6 @@ job "mediawiki" { PARSOID_URI = "http://${NOMAD_UPSTREAM_ADDR_parsoid}" MATHOID_URI = "http://${NOMAD_UPSTREAM_ADDR_mathoid}" } - - resources { - memory = 128 - } } network { @@ -414,10 +423,11 @@ job "mediawiki" { config { image = "wikimedia/mathoid:bad5ec8d4" + memory_hard_limit = 600 } resources { - memory = 128 + memory = 150 } }