fix OOM kills: tune MySQL memory, reduce Nextcloud workers, increase Uptime Kuma limit

MySQL (3 OOM kills):
- Cap group_replication_message_cache_size to 128MB (default 1GB caused OOM)
- Reduce innodb_log_buffer_size from 64MB to 16MB
- Lower max_connections from 151 to 80 (peak usage ~40)
- Increase memory limit from 3Gi to 4Gi for headroom

Nextcloud (30+ apache2 OOM kills per incident):
- Reduce MaxRequestWorkers from 50 to 10 to prevent fork bomb
  when SQLite locks cause request pileup
- Lower StartServers/MinSpare/MaxSpare proportionally

Uptime Kuma (Node.js memory leak):
- Increase memory limit from 256Mi to 512Mi
- Increase CPU limit from 200m to 500m

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-03-12 07:26:08 +00:00
parent f2c7444159
commit 81bfccaefc
3 changed files with 25 additions and 19 deletions

View file

@ -171,6 +171,12 @@ resource "helm_release" "mysql_cluster" {
group_replication_member_expel_timeout=30
group_replication_unreachable_majority_timeout=60
group_replication_start_on_boot=ON
# Cap XCom cache to prevent unbounded growth (default 1GB causes OOM)
group_replication_message_cache_size=134217728
# Reduce log buffer (16MB sufficient for this workload, was 64MB)
innodb_log_buffer_size=16777216
# Limit connections (peak usage ~40, no need for 151)
max_connections=80
EOT
}
@ -181,7 +187,7 @@ resource "helm_release" "mysql_cluster" {
}
limits = {
cpu = "2"
memory = "3Gi"
memory = "4Gi"
}
}

View file

@ -71,8 +71,8 @@ resource "kubernetes_deployment" "uptime-kuma" {
memory = "64Mi"
}
limits = {
cpu = "200m"
memory = "256Mi"
cpu = "500m"
memory = "512Mi"
}
}