Skip to content

chore: 운영 SQL 로그를 끄고 메모리·종료 설정을 측정 기준으로 조정한다 - #145

Merged
ff1451 merged 3 commits into
mainfrom
chore/ops-config
Oct 16, 2026
Merged

ff1451 merged 3 commits into
mainfrom
chore/ops-config

Conversation

@ff1451

@ff1451 ff1451 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

#141(테스트 인프라) 위에 쌓인 PR이다. #141이 머지되면 base가 main으로 바뀐다.

요약

  1. 운영 SQL 로그 끄기: application.yml이 유일한 설정 파일인데 show-sql: true라 운영 로그에 모든 쿼리가 찍혔다. 기본 false, 로컬에서는 JPA_SHOW_SQL=true.
  2. 메모리: 300MiB 한도 컨테이너에서 실제로 측정해 조정했다(아래).
  3. 배포 시 종료: docker stop 기본 대기 10초가 Spring graceful shutdown(기본 30초)보다 짧아, 처리 중인 요청과 @Async 메일 큐가 강제 종료로 잘렸다.

메모리 측정

eclipse-temurin:21-jdk + --memory=300m + Dockerfile과 같은 플래그 + NMT로 앱을 띄우고, 동시 150개로 공개 API·로그인 요청 18,000건을 보낸 뒤 측정했다(로컬 x86·WSL(스왑 있음), 운영은 arm64라 수치는 근사).

NMT committed 기존 이 PR
합계 약 373MiB 약 347MiB
힙 136MiB 126MiB
스레드 수 175 73
Metaspace 105MiB 106MiB
코드 캐시 29MiB 23MiB
  • 절감은 대부분 Tomcat 스레드 상한 200 → 50에서 나온다. 그 밖에 -XX:MaxRAMPercentage=40(45), -Xss512k, -XX:ReservedCodeCacheSize=32m(48m).
  • Metaspace 사용이 약 120MiB라 상한 160m은 줄이지 않았다(줄이면 기동 직후 OOM 종료 위험).
  • C1 전용 JIT(-XX:TieredStopAtLevel=1)도 시험했지만, 로그인(BCrypt cost 12) 응답 중앙값이 322ms → 397ms(약 23%)로 느려져 넣지 않았다.
  • 조정 후에도 컨테이너 사용량은 300MiB에 붙는다. 플래그만으로는 여유가 생기지 않으므로, 운영 메모리 한도(--memory=300m)를 올릴지는 서버 여유를 보고 따로 정해야 한다. 이 PR은 한도를 바꾸지 않는다.

종료

  • spring.lifecycle.timeout-per-shutdown-phase: 20s, spring.task.execution.shutdown.await-termination: true(20초).
  • deploy.yml: docker stop -t 45.
  • 로컬에서 SIGTERM 시 Commencing graceful shutdown → Graceful shutdown complete 확인. SQL 로그가 찍히지 않는 것도 확인.

테스트

  • 로컬 전체 ./gradlew test: 532건 중 531 통과, 1 스킵.
  • 같은 스위트를 -Xss512k로 한 번 더 돌려 스택 오버플로가 없음을 확인.

- show-sql 기본값을 false로(JPA_SHOW_SQL로 로컬에서 켤 수 있음). 운영 로그에 모든 쿼리가 찍히고 있었다.
- Tomcat 최대 스레드 200 -> 50, JVM은 C1 전용 JIT·코드 캐시 32m·스택 512k·힙 40%로.
  300MiB 한도에서 부하 중 NMT committed 합계가 약 373MiB -> 333MiB로 줄었다.
  Metaspace 사용이 약 120MiB라 상한 160m은 유지한다.
- 종료 시 요청(20초)과 큐의 비동기 메일(20초)을 기다리고, deploy.yml의 docker stop 대기를
  기본 10초에서 45초로 늘려 graceful shutdown이 강제 종료되지 않게 한다.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0ca52f09-a2f3-4497-9051-50fdbaa19a1f
📥 Commits

Reviewing files that changed from the base of the PR and between 0690ad0 and 45a1d91.

📒 Files selected for processing: 3
  • .github/workflows/deploy.yml
  • Dockerfile
  • src/main/resources/application.yml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

로그인(BCrypt cost 12) 응답 중앙값이 322ms에서 397ms로 약 23% 느려졌다.
메모리 절감은 대부분 스레드 수 축소에서 나오므로 나머지 플래그는 유지한다.
@ff1451
ff1451 changed the base branch from refactor/test-infra to main October 16, 2026 07:07
@ff1451
ff1451 merged commit be02c09 into main Oct 16, 2026
2 checks passed
@ff1451
ff1451 deleted the chore/ops-config branch October 16, 2026 08:10
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.

1 participant