File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,19 @@ plugin "containerd-driver" {
88 }
99}
1010
11+ server {
12+ default_scheduler_config {
13+ scheduler_algorithm = " spread"
14+ memory_oversubscription_enabled = true
15+
16+ preemption_config {
17+ batch_scheduler_enabled = true
18+ system_scheduler_enabled = true
19+ service_scheduler_enabled = true
20+ }
21+ }
22+ }
23+
1124client {
1225 host_volume "s1" {
1326 path = " /tmp/host_volume/s1"
Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ job "redis" {
1313 }
1414
1515 resources {
16- cpu = 500
17- memory = 256
16+ cpu = 500
17+ memory = 256
18+ memory_max = 512
1819 }
1920 }
2021 }
Original file line number Diff line number Diff line change @@ -49,6 +49,19 @@ test_redis_nomad_job() {
4949 exit 1
5050 fi
5151
52+ echo " INFO: Check if memory and memory_max are set correctly in the cgroup filesystem."
53+ task_name=$( sudo CONTAINERD_NAMESPACE=nomad ctr containers ls| awk ' NR!=1' | cut -d' ' -f1)
54+ memory_soft_limit=$( sudo cat /sys/fs/cgroup/memory/nomad/$task_name /memory.soft_limit_in_bytes)
55+ if [ $memory_soft_limit != " $(( 256 * 1024 * 1024 )) " ]; then
56+ echo " ERROR: memory should be 256 MB. Found ${memory_soft_limit} ."
57+ exit 1
58+ fi
59+ memory_hard_limit=$( sudo cat /sys/fs/cgroup/memory/nomad/$task_name /memory.limit_in_bytes)
60+ if [ $memory_hard_limit != " $(( 512 * 1024 * 1024 )) " ]; then
61+ echo " ERROR: memory_max should be 512 MB. Found ${memory_hard_limit} ."
62+ exit 1
63+ fi
64+
5265 echo " INFO: Stopping nomad redis job."
5366 nomad job stop redis
5467 redis_status=$( nomad job status -short redis| grep Status| awk ' {split($0,a,"="); print a[2]}' | tr -d ' ' )
You can’t perform that action at this time.
0 commit comments