Skip to content

Commit

Permalink
Add memory limits / reservations (:warning: OPS) (#384)
Browse files Browse the repository at this point in the history
* Add memory limits / reservations

* Remove empty cpu

* Remove added CPU

* Minor fixes
  • Loading branch information
YuryHrytsuk authored Oct 5, 2023
1 parent 2b65c89 commit f26cff9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
36 changes: 19 additions & 17 deletions services/monitoring/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ services:
memory: 4096M
reservations:
memory: 4096M

prometheuscadvisor:
hostname: "{% raw %}{{.Service.Name}}{% endraw %}"
image: prom/prometheus:v2.46.0
Expand Down Expand Up @@ -124,7 +125,8 @@ services:
limits:
memory: 4096M
reservations:
memory: 4096M
memory: 2048M

node-exporter:
image: prom/node-exporter:v1.6.1
volumes:
Expand Down Expand Up @@ -177,9 +179,9 @@ services:
mode: global
resources:
limits:
memory: 128M
reservations:
memory: 64M
reservations:
memory: 32M

alertmanager:
image: prom/alertmanager:v0.25.0
Expand All @@ -199,9 +201,9 @@ services:
- node.role==manager
resources:
limits:
memory: 128M
memory: 32M
reservations:
memory: 64M
memory: 16M

cadvisor-exporter:
image: gcr.io/cadvisor/cadvisor:v0.47.2
Expand All @@ -223,7 +225,7 @@ services:
limits:
memory: 256M
reservations:
memory: 256M
memory: 128M

docker-events-exporter:
image: itisfoundation/docker-events-exporter:latest
Expand All @@ -240,9 +242,9 @@ services:
mode: global
resources:
limits:
memory: 128M
reservations:
memory: 64M
reservations:
memory: 32M

grafana:
image: grafana/grafana-oss:10.0.3
Expand Down Expand Up @@ -271,9 +273,9 @@ services:
- traefik.http.routers.grafana.middlewares=ops_whitelist_ips@docker, ops_gzip@docker, grafana_replace_regex
resources:
limits:
memory: 128M
memory: 256M
reservations:
memory: 64M
memory: 128M

grafana-image-renderer:
image: grafana/grafana-image-renderer:3.7.1
Expand Down Expand Up @@ -312,7 +314,7 @@ services:
limits:
memory: 128M
reservations:
memory: 64M
memory: 32M

dcgm-exporter:
cap_add:
Expand All @@ -329,10 +331,10 @@ services:
- node.labels.gpu==true
resources:
limits:
memory: 350M #via trial and error test on tip-deployment DK Aug2023
memory: 512M
reservations:
memory: 350M #via trial and error test on tip-deployment DK Aug2023
labels:
memory: 256M
labels:
- prometheus-job=dcgm-exporter
- prometheus-port=9400

Expand Down Expand Up @@ -373,7 +375,7 @@ services:
limits:
memory: 128M
reservations:
memory: 64M
memory: 32M
{{_stack}}-redis-exporter:
image: oliver006/redis_exporter:v1.52.0-alpine
networks:
Expand All @@ -388,6 +390,6 @@ services:
- node.labels.prometheus==true
resources:
limits:
memory: 128M
memory: 64M
reservations:
memory: 64M{% endfor %}
memory: 32M{% endfor %}
9 changes: 7 additions & 2 deletions services/traefik/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ services:
memory: 2048M
cpus: '3.000'
reservations:
memory: 2048M
cpus: '3.000'
memory: 500M
cpus: '1.000'
placement:
constraints:
- node.role == manager
Expand Down Expand Up @@ -147,6 +147,11 @@ services:
- traefik.http.routers.whoami.tls=true
- traefik.http.routers.whoami.middlewares=ops_whitelist_ips@docker,
ops_auth@docker, ops_gzip@docker
resources:
limits:
memory: 50M
reservations:
memory: 6M
networks:
- public
Expand Down

0 comments on commit f26cff9

Please sign in to comment.