From d83631bba8d7d0e4d025f99cf92db9d4055441af Mon Sep 17 00:00:00 2001 From: elliotechne Date: Sat, 14 Mar 2026 16:33:01 -0400 Subject: [PATCH] fix: reduce to 1 gunicorn worker and increase memory limit to 2Gi 2 workers still OOM'd, meaning the app needs >600MB per worker process. Switching to 1 worker + 4 threads avoids duplicate process memory overhead while maintaining concurrency (appropriate for I/O-bound Flask). Memory limit raised to 2Gi with 768Mi request to give the single worker sufficient headroom. Co-Authored-By: Claude Sonnet 4.6 --- Dockerfile | 2 +- terraform/variables.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index ece5c35..863e5a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -65,4 +65,4 @@ HEALTHCHECK --interval=30s \ CMD curl -f http://localhost:8080/health || exit 1 # Start the application with gunicorn (after waiting for PostgreSQL) -CMD ["/bin/bash", "-c", "wait-for-db.sh gunicorn --bind 0.0.0.0:8080 --workers 2 --threads 2 --timeout 60 --access-logfile - --error-logfile - 'app.main:create_app()'"] +CMD ["/bin/bash", "-c", "wait-for-db.sh gunicorn --bind 0.0.0.0:8080 --workers 1 --threads 4 --timeout 60 --access-logfile - --error-logfile - 'app.main:create_app()'"] diff --git a/terraform/variables.tf b/terraform/variables.tf index 327c2df..0298d0b 100755 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -160,13 +160,13 @@ variable "app_cpu_limit" { variable "app_memory_request" { description = "Memory request for application pods" type = string - default = "512Mi" + default = "768Mi" } variable "app_memory_limit" { description = "Memory limit for application pods" type = string - default = "1250Mi" + default = "2Gi" } # Docker Registry Configuration