From bcd7bca84898c57a9fedd8eb1ab3d32661af4d65 Mon Sep 17 00:00:00 2001 From: Tero Keski-Valkama Date: Sat, 10 Dec 2022 16:45:55 +0100 Subject: [PATCH] Added memory requests to be more realistic. This makes Kubernetes make better choices about where to schedule the pods, and communicates to the administrators about the minimum sensible resource requirements. On a single user Mastodon instance on a three node Kubernetes after a week of so use we get these memory uses per pod: ``` tero@arcones:~$ kubectl top pods -n mastodon NAME CPU(cores) MEMORY(bytes) mastodon-elasticsearch-coordinating-0 6m 403Mi mastodon-elasticsearch-coordinating-1 28m 189Mi mastodon-elasticsearch-data-0 10m 1432Mi mastodon-elasticsearch-data-1 5m 1513Mi mastodon-elasticsearch-ingest-0 6m 418Mi mastodon-elasticsearch-ingest-1 6m 396Mi mastodon-elasticsearch-master-0 24m 466Mi mastodon-elasticsearch-master-1 10m 221Mi mastodon-postgresql-0 12m 276Mi mastodon-redis-master-0 16m 37Mi mastodon-redis-replicas-0 7m 34Mi mastodon-sidekiq-all-queues-549b4bb7b4-zvj2m 266m 499Mi mastodon-streaming-78465f778d-6xfg2 1m 96Mi mastodon-web-774c5c94f9-f5bhz 22m 418Mi ``` Hence we make the following adjustments to Bitnami defaults: - `mastodon-elasticsearch-coordinating`: `256Mi->512Mi` - `mastodon-elasticsearch-data`: The default `2048Mi` is ok. - `mastodon-elasticsearch-master`: `256Mi->512Mi` - `mastodon-redis-master`: `0->56Mi` - `mastodon-redis-replicas`: `0->56Mi` - `mastodon-postgresql`: `256->384Mi` And for Mastodon defaults: - `mastodon-sidekiq-all-queues`: `0->512Mi` - `mastodon-streaming`: `0->128Mi` - `mastodon-web`: `0->512Mi` The original idea of keeping these requests zero is a good default when minimal requirements are unknown. However, from a single user node we get minimal requirements and having the limits as zero only leads to trouble for people. Of course the system requirements will change over time, but they are chiefly expected to go upwards. --- values.yaml | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/values.yaml b/values.yaml index 0b926b8..cfcad80 100644 --- a/values.yaml +++ b/values.yaml @@ -82,15 +82,15 @@ mastodon: # -- (Sidekiq Container) Security Context for all Pods, overwrites .Values.securityContext securityContext: {} # -- Resources for all Sidekiq Deployments unless overwritten - resources: {} - # -- Affinity for all Sidekiq Deployments unless overwritten, overwrites .Values.affinity - affinity: {} + resources: + requests: + cpu: 250m + memory: 512Mi # limits: # cpu: "1" # memory: 768Mi - # requests: - # cpu: 250m - # memory: 512Mi + # -- Affinity for all Sidekiq Deployments unless overwritten, overwrites .Values.affinity + affinity: {} workers: - name: all-queues # -- Number of threads / parallel sidekiq jobs that are executed per Pod @@ -162,13 +162,13 @@ mastodon: # -- (Streaming Container) Security Context for Streaming Pods, overwrites .Values.securityContext securityContext: {} # -- (Streaming Container) Resources for Streaming Pods, overwrites .Values.resources - resources: {} + resources: + requests: + cpu: 250m + memory: 128Mi # limits: # cpu: "500m" # memory: 512Mi - # requests: - # cpu: 250m - # memory: 128Mi web: port: 3000 # -- Number of Web Pods running @@ -180,13 +180,13 @@ mastodon: # -- (Web Container) Security Context for Web Pods, overwrites .Values.securityContext securityContext: {} # -- (Web Container) Resources for Web Pods, overwrites .Values.resources - resources: {} + resources: + requests: + cpu: 250m + memory: 512Mi # limits: # cpu: "1" # memory: 1280Mi - # requests: - # cpu: 250m - # memory: 768Mi metrics: statsd: @@ -231,6 +231,18 @@ elasticsearch: # @ignored image: tag: 7 + coordinating: + resources: + requests: + memory: 512Mi + ingest: + resources: + requests: + memory: 512Mi + master: + resources: + requests: + memory: 512Mi # https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters postgresql: @@ -253,6 +265,10 @@ postgresql: # you can also specify the name of an existing Secret # with a key of password set to the password you want existingSecret: "" + primary: + resources: + requests: + memory: 384Mi # https://github.com/bitnami/charts/tree/master/bitnami/redis#parameters redis: @@ -268,6 +284,14 @@ redis: # with a key of redis-password set to the password you want # auth: # existingSecret: "" + master: + resources: + requests: + memory: 56Mi + replica: + resources: + requests: + memory: 56Mi # @ignored service: