Skip to content

[Fix] Configure resource limits to fix development server timeout#93

Merged
char-yb merged 1 commit intodevelopfrom
fix/dev-timeout
Feb 3, 2026
Merged

[Fix] Configure resource limits to fix development server timeout#93
char-yb merged 1 commit intodevelopfrom
fix/dev-timeout

Conversation

@LeeHanEum
Copy link
Collaborator

@LeeHanEum LeeHanEum commented Feb 2, 2026

🌱 관련 이슈

📌 작업 내용 및 특이 사항

  • 메모리 부족 문제로 인한 개발 서버 타임아웃 도커 리소스 제한으로 해결합니다
  • 애플리케이션 최대 768M + 로컬 레디스 최대 64MB로 리소스 제한

📝 참고

스크린샷 2026-02-02 22 27 23 스크린샷 2026-02-02 22 27 44

📌 체크 리스트

  • 리뷰어를 추가하셨나요 ?
  • 변경사항에 대해 충분히 설명하고 있나요 ?

Summary by CodeRabbit

Release Notes

  • Chores
    • Configured resource allocation settings with CPU and memory limits and reservations for backend and caching services to ensure optimal system performance and application stability.
    • These infrastructure updates establish boundaries for resource usage, prevent contention between services, and improve overall reliability during peak loads and high-traffic scenarios.

@LeeHanEum LeeHanEum requested a review from char-yb February 2, 2026 14:00
@LeeHanEum LeeHanEum self-assigned this Feb 2, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

Resource constraints are added to the Docker Compose configuration for the backend and redis services, specifying CPU and memory limits and reservations to define resource boundaries for container execution.

Changes

Cohort / File(s) Summary
Docker Compose Resource Configuration
docker/docker-compose.yml
Added deploy.resources with CPU and memory limits (backend: 0.80 cpus/768M, redis: 0.20 cpus/64M) and reservations (backend: 0.20 cpus/256M, redis: 0.10 cpus/32M).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop, hop, resources constrained!
No more timeout woes, bandwidth ordained,
Docker containers with limits so tight,
Redis and backend sleep through the night! 🌙

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: configuring resource limits to fix development server timeout, which directly aligns with the changeset that adds Docker resource limits.
Linked Issues check ✅ Passed The PR addresses the linked issue #92 by configuring Docker resource limits to resolve development server timeouts, directly targeting the stated objective despite minimal issue details.
Out of Scope Changes check ✅ Passed All changes are scoped to configuring Docker resource limits for backend and redis services in docker-compose.yml, directly aligned with resolving the development timeout issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/dev-timeout

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docker/docker-compose.yml`:
- Around line 13-20: The compose uses deploy.resources.reservations which Docker
Compose (non‑Swarm) ignores; update the services that have
deploy.resources.limits/reservations to also set service‑level resource keys
(add mem_limit, mem_reservation, and cpus under each service alongside the
existing deploy section) so reservations are enforced during docker compose up,
or alternatively change deployment to use swarm mode (use docker stack deploy)
if you intend to rely on deploy.resources.reservations; apply the same change
for the other service that has a reservations block.

Comment on lines +13 to +20
deploy:
resources:
limits:
cpus: '0.80'
memory: 768M
reservations:
cpus: '0.20'
memory: 256M
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, examine the docker-compose.yml structure and context
cat -n docker/docker-compose.yml | head -50

Repository: Team-PIDA/Pida-Server

Length of output: 1376


🏁 Script executed:

# Check for any deployment scripts or documentation
find . -type f \( -name "*.md" -o -name "*.txt" -o -name "Makefile" -o -name "*.sh" \) | head -20

Repository: Team-PIDA/Pida-Server

Length of output: 381


🏁 Script executed:

# Search for references to docker compose deployment strategy
rg -i "docker.*stack\|docker.*compose\|swarm" --max-count=20

Repository: Team-PIDA/Pida-Server

Length of output: 47


🌐 Web query:

Docker Compose deploy.resources non-Swarm mode behavior compatibility flag

💡 Result:

  • deploy.* is part of the Compose Specification, but it’s primarily a “platform/orchestrator” section. In practice, docker stack deploy (Swarm) is the environment where all deploy semantics are intended to apply (replicas, update/rollback policies, placement, etc.). (docs.docker.com)
  • In non‑Swarm mode (docker compose up) the only widely useful/implemented piece of deploy is deploy.resources (resource limits). Docker documents deploy.resources as constraints (limits/reservations) in the spec, but what actually gets enforced locally depends on the Compose implementation/version. (docs.docker.com)
  • What the --compatibility flag is for: historically (Compose v1 era), --compatibility made docker-compose read deploy and translate a small subset into non‑Swarm runtime options—notably resource limits / memory reservations, replicas, and parts of restart_policy; everything else was ignored (often with warnings). (docs4dev.com)
  • In Compose v2, --compatibility is no longer “the” way to get resource limits from deploy—it’s described as deprecated for YAML-field migration, and it also has behavior around name formatting to match v1 expectations. (docs.docker.com)

So, if your goal is “make deploy.resources work in non‑Swarm”:

  • On older docker-compose (v1), you generally needed docker-compose --compatibility up to have deploy.resources translated into local container limits. (docs4dev.com)
  • On modern docker compose (v2), resource limits may already be honored without --compatibility, but many other deploy keys still won’t behave like Swarm (because there’s no orchestrator). (docs.docker.com)

Citations:


🏁 Script executed:

# Check README for deployment guidance
cat README.md | grep -i "docker\|compose\|deploy\|version" -A 3 -B 1

Repository: Team-PIDA/Pida-Server

Length of output: 47


🏁 Script executed:

# Look for .github workflows or CI files that might indicate Docker version
fd "\.yml|\.yaml" .github/workflows 2>/dev/null | head -10 | xargs cat 2>/dev/null | grep -i "docker\|compose\|version" | head -20

Repository: Team-PIDA/Pida-Server

Length of output: 979


🏁 Script executed:

# Check Dockerfile for version hints
fd "Dockerfile" | head -5 | xargs cat 2>/dev/null | head -30

Repository: Team-PIDA/Pida-Server

Length of output: 597


🏁 Script executed:

# Search for any requirements or configuration files mentioning docker/compose versions
rg "docker.*compose|compose.*version" --type yml --type yaml --type json --max-count=10

Repository: Team-PIDA/Pida-Server

Length of output: 92


🌐 Web query:

Docker Compose v2 deploy.resources non-Swarm local mode enforcement 2024 2025

💡 Result:

In Docker Compose v2 (local / non‑Swarm mode), deploy.resources is partially applied:

  • deploy.resources.limits is enforced (Compose translates it into the container runtime’s hard limits, e.g., cgroup CPU/memory caps). Docker’s Compose Deploy spec defines limits as “the platform must prevent the container from allocating more resources.” [1]
  • deploy.resources.reservations is generally not enforced in local Compose (no scheduler/orchestrator to “guarantee” capacity). This is a long-standing Compose behavior/bug report: reservations “has no effect in NON SWARM mode,” while limits do. [2]
  • More broadly, local docker compose does not deploy across a Swarm (all containers run on the current node). To use Swarm’s deployment semantics, use docker stack deploy. [3]

Implication for 2024–2025: if you need hard enforcement in local Compose, rely on deploy.resources.limits; don’t expect reservations to be honored unless your target platform/orchestrator implements it.

Sources:
[1] Docker Docs – Compose Deploy Specification (resources.limits / resources.reservations) (docs.docker.com)
[2] docker/compose issue #10046 – reservations no effect in non‑Swarm (github.com)
[3] Docker Docs – “Deploy a stack to a swarm” (Compose doesn’t use swarm; use docker stack deploy) (docs.docker.com)

Citations:


deploy.resources.reservations won't be enforced in non‑Swarm Compose mode.
While deploy.resources.limits are correctly applied by Docker Compose v2, deploy.resources.reservations are ignored without a Swarm orchestrator. Since this is meant to fix development timeouts, if resource reservations matter for your use case, add service-level keys (mem_limit, mem_reservation, cpus) alongside the deploy section, or ensure the dev workflow uses docker stack deploy instead of docker compose up.

💡 Suggested adjustment for enforcing reservations in non‑Swarm Compose
 services:
   backend:
     image: ${IMAGE_FULL_URL}
     container_name: ${DOCKERHUB_IMAGE_NAME}
     restart: always
     environment:
       - TZ=Asia/Seoul
     network_mode: host
     env_file:
       - ~/.env
     depends_on:
       - redis
     deploy:
       resources:
         limits:
           cpus: '0.80'
           memory: 768M
         reservations:
           cpus: '0.20'
           memory: 256M
+    mem_limit: 768M
+    mem_reservation: 256M
   redis:
     image: redis:7.2-alpine
     container_name: p-local-redis
     command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
     network_mode: "host"
     volumes:
       - /opt/redis/data:/data
       - /opt/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
     environment:
       - TZ=Asia/Seoul
     restart: unless-stopped
     healthcheck:
       test: [ "CMD", "redis-cli", "PING" ]
       interval: 5s
       timeout: 3s
       retries: 10
     deploy:
       resources:
         limits:
           cpus: '0.20'
           memory: 64M
         reservations:
           cpus: '0.10'
           memory: 32M
+    mem_limit: 64M
+    mem_reservation: 32M

Also applies to: 37-44

🤖 Prompt for AI Agents
In `@docker/docker-compose.yml` around lines 13 - 20, The compose uses
deploy.resources.reservations which Docker Compose (non‑Swarm) ignores; update
the services that have deploy.resources.limits/reservations to also set
service‑level resource keys (add mem_limit, mem_reservation, and cpus under each
service alongside the existing deploy section) so reservations are enforced
during docker compose up, or alternatively change deployment to use swarm mode
(use docker stack deploy) if you intend to rely on
deploy.resources.reservations; apply the same change for the other service that
has a reservations block.

Copy link
Member

@char-yb char-yb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
이런 옵션이 있을 줄 몰랐는데, 첨알았네요👍

@char-yb char-yb merged commit d959f6c into develop Feb 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 개발 서버 타임아웃 이슈 해결

2 participants