Skip to content

테스트#766

Closed
kkiseug wants to merge 1 commit intomainfrom
prod-rollback2
Closed

테스트#766
kkiseug wants to merge 1 commit intomainfrom
prod-rollback2

Conversation

@kkiseug
Copy link
Contributor

@kkiseug kkiseug commented Mar 3, 2026

🛠️ 설명

📸 스크린샷 / 동영상

AS-IS TO-BE

🔍 리뷰 요청사항

🔗 관련 이슈

  • closes #이슈번호

Summary by CodeRabbit

개선 사항

  • 데이터베이스 연결 풀 및 타임아웃 설정을 추가하여 백엔드 안정성과 성능을 향상했습니다.
  • 연결 관리 효율성을 개선하여 더욱 안정적인 서비스 운영을 지원합니다.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

요약

MongoDB 프로덕션 환경 설정을 평면 구조에서 중첩 구조로 재구성하고, 연결 풀 및 타임아웃 설정이 추가되었습니다. 인증 필드는 환경 변수에서 유지됩니다.

변경 사항

Cohort / File(s) 요약
MongoDB 설정 재구성
backend/src/main/resources/application-prod.yml
MongoDB 설정을 평면 구조(data.mongodb.host/port/database 등)에서 중첩 구조(data.mongodb 블록)로 변경. max-pool-size(30), min-pool-size(10), max-wait-time(2000ms), socket-timeout(3000ms), connect-timeout(1000ms), max-connection-idle-time(30000ms) 추가.

예상 코드 리뷰 소요 시간

🎯 1 (Trivial) | ⏱️ ~3 분

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning PR 제목이 '테스트'로 매우 모호하며, 변경사항인 MongoDB 연결 풀 설정 조정과 무관합니다. 제목을 '스프링 MongoDB 연결 풀 사이즈 및 타임아웃 설정 조정'과 같이 실제 변경사항을 명확히 나타내도록 수정하세요.
Description check ⚠️ Warning PR 설명이 템플릿 구조만 있고 모든 섹션이 미입력 상태로 실제 변경사항, 스크린샷, 리뷰 요청, 관련 이슈가 기재되지 않았습니다. '설명' 섹션에 MongoDB 연결 풀 설정 변경 내용을 입력하고, '관련 이슈' 섹션의 실제 이슈 번호로 채워주세요.
✅ Passed checks (1 passed)
Check name Status Explanation
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 prod-rollback2

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

@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

🧹 Nitpick comments (1)
backend/src/main/resources/application-prod.yml (1)

19-26: 운영 튜닝 값은 환경변수로 외부화하는 것을 권장합니다.

현재 하드코딩이라 운영 환경별 조정 시 재배포가 필요합니다.

🔧 제안 변경안
       # Connection Pool 설정
-      max-pool-size: 30
-      min-pool-size: 10
+      max-pool-size: ${MONGO_MAX_POOL_SIZE:30}
+      min-pool-size: ${MONGO_MIN_POOL_SIZE:10}

       # timeout 설정
-      max-wait-time: 2000
-      socket-timeout: 3000
-      connect-timeout: 1000
-      max-connection-idle-time: 30000
+      max-wait-time: ${MONGO_MAX_WAIT_TIME_MS:2000}
+      socket-timeout: ${MONGO_SOCKET_TIMEOUT_MS:3000}
+      connect-timeout: ${MONGO_CONNECT_TIMEOUT_MS:1000}
+      max-connection-idle-time: ${MONGO_MAX_CONN_IDLE_TIME_MS:30000}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/resources/application-prod.yml` around lines 19 - 26,
Replace the hard-coded pool and timeout values with environment-variable
placeholders so production tuning doesn't require redeploy: change the keys
max-pool-size, min-pool-size, max-wait-time, socket-timeout, connect-timeout,
and max-connection-idle-time to use Spring property placeholders (e.g.
${ENV_VAR:default}) and pick sensible defaults; ensure the service reads these
properties as before (no code changes needed) and document the expected ENV_VAR
names for operators so env vars can override values per environment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@backend/src/main/resources/application-prod.yml`:
- Around line 19-26: The YAML uses unsupported MongoDB pool/timeout properties
(max-pool-size, min-pool-size, max-wait-time, socket-timeout, connect-timeout,
max-connection-idle-time) for Spring Boot 3.5.3 so replace them by either
setting connection options in the Mongo URI via spring.data.mongodb.uri (include
maxPoolSize, minPoolSize, connectTimeoutMS, socketTimeoutMS, authSource as query
params) or implement a MongoClientSettingsBuilderCustomizer bean to
programmatically set MongoClientSettings (configure connectionPoolSettings and
socketSettings/connectTimeouts) so the pool/timeouts take effect.

---

Nitpick comments:
In `@backend/src/main/resources/application-prod.yml`:
- Around line 19-26: Replace the hard-coded pool and timeout values with
environment-variable placeholders so production tuning doesn't require redeploy:
change the keys max-pool-size, min-pool-size, max-wait-time, socket-timeout,
connect-timeout, and max-connection-idle-time to use Spring property
placeholders (e.g. ${ENV_VAR:default}) and pick sensible defaults; ensure the
service reads these properties as before (no code changes needed) and document
the expected ENV_VAR names for operators so env vars can override values per
environment.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 734b043 and 4a2285f.

📒 Files selected for processing (1)
  • backend/src/main/resources/application-prod.yml

Comment on lines +19 to +26
max-pool-size: 30
min-pool-size: 10

# timeout 설정
max-wait-time: 2000
socket-timeout: 3000
connect-timeout: 1000
max-connection-idle-time: 30000
Copy link

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, find the Spring Boot version
if [ -f "pom.xml" ]; then
  echo "=== pom.xml found ==="
  grep -A 2 -B 2 "spring-boot" pom.xml | head -20
elif [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]; then
  echo "=== Gradle build file found ==="
  grep -i "spring.*boot" build.gradle* 2>/dev/null | head -20
fi

Repository: woowacourse-teams/2025-course-pick

Length of output: 60


🏁 Script executed:

# Also check if there's a parent pom or version file
find . -type f \( -name "pom.xml" -o -name "build.gradle*" -o -name "*.properties" \) | grep -E "(pom|build|version)" | head -20

Repository: woowacourse-teams/2025-course-pick

Length of output: 162


🏁 Script executed:

# Check the backend build.gradle.kts for Spring Boot version
cat backend/build.gradle.kts | head -50

Repository: woowacourse-teams/2025-course-pick

Length of output: 1405


🌐 Web query:

Spring Boot 3.5.3 MongoDB connection pool properties spring.data.mongodb max-pool-size socket-timeout

💡 Result:

In Spring Boot 3.5.x, Spring Boot’s spring.data.mongodb.* properties do not include dedicated “pool” or “socket timeout” fields (Boot mainly exposes spring.data.mongodb.uri, etc.). (docs.spring.io)
So, to set max pool size and socket timeout, use one of these approaches:

1) Put driver options on spring.data.mongodb.uri (recommended for simple config)

MongoDB Java driver supports these URI options:

  • Pool size: maxPoolSize (and minPoolSize)
  • Timeouts: connectTimeoutMS, socketTimeoutMS (note: socketTimeoutMS is deprecated in newer driver docs in favor of client-level timeout) (mongodb.com)

Example (application.yml):

spring:
  data:
    mongodb:
      uri: mongodb://user:pass@host:27017/mydb?maxPoolSize=50&connectTimeoutMS=10000&socketTimeoutMS=15000

Defaults worth knowing: maxPoolSize defaults to 100 if not set. (mongodb.ac.cn)

2) Customize MongoClientSettings (best if you want “typed” config / advanced tuning)

Spring Boot builds the client using MongoClientSettings, and the MongoDB driver lets you set pool and socket settings there (e.g., socket read timeout). (mongodb.com)

Citations:


🌐 Web query:

Spring Data MongoDB connection pool configuration spring.data.mongodb.uri options replicaSet maxPoolSize socketTimeoutMS

💡 Result:

In Spring Boot / Spring Data MongoDB you can pass MongoDB driver connection-string options directly via spring.data.mongodb.uri, and Spring Boot will apply them when it auto-configures MongoClientSettings. (docs.spring.io)

1) Configure via spring.data.mongodb.uri (replicaSet, pool, timeouts)

Example:

spring.data.mongodb.uri=mongodb://user:pass@host1:27017,host2:27017,host3:27017/mydb\
?replicaSet=rs0\
&maxPoolSize=200\
&minPoolSize=10\
&socketTimeoutMS=45000\
&connectTimeoutMS=10000

Relevant URI options (driver-level):

  • replicaSet (replica set name) (mongodb.com)
  • maxPoolSize / minPoolSize (connection pool sizing; maxPoolSize default is 100) (mongodb.com)
  • socketTimeoutMS (socket read/write timeout; docs note default “never timeout”, driver-dependent) (mongodb.com)
  • connectTimeoutMS (connect timeout) (mongodb.com)

Note: in the Java driver, pool sizing applies per server in the topology. (mongodb.com)

2) When URI options aren’t enough: customize MongoClientSettings

Spring Boot supports MongoClientSettingsBuilderCustomizer to fine-tune MongoClientSettings. (docs.spring.io)

Citations:


🏁 Script executed:

cat backend/src/main/resources/application-prod.yml

Repository: woowacourse-teams/2025-course-pick

Length of output: 901


Spring Boot 3.5.3에서는 지정한 MongoDB 풀/타임아웃 속성들이 지원되지 않습니다.

현재 설정의 max-pool-size, min-pool-size, max-wait-time, socket-timeout, connect-timeout, max-connection-idle-time은 Spring Boot 3.5.3에서 인식되지 않는 속성으로, 이들은 무시되고 PR의 목적(커넥션 풀 조정)이 전혀 반영되지 않습니다.

다음 중 하나의 방법으로 수정하세요:

  1. spring.data.mongodb.uri를 사용 (권장):

    spring:
      data:
        mongodb:
          uri: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DATABASE}?authSource=${MONGO_AUTH_DATABASE}&maxPoolSize=30&minPoolSize=10&connectTimeoutMS=1000&socketTimeoutMS=3000
  2. MongoClientSettingsBuilderCustomizer 빈 생성: 더 복잡한 설정이 필요한 경우 커스텀 빈을 작성하여 MongoClientSettings를 직접 구성합니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@backend/src/main/resources/application-prod.yml` around lines 19 - 26, The
YAML uses unsupported MongoDB pool/timeout properties (max-pool-size,
min-pool-size, max-wait-time, socket-timeout, connect-timeout,
max-connection-idle-time) for Spring Boot 3.5.3 so replace them by either
setting connection options in the Mongo URI via spring.data.mongodb.uri (include
maxPoolSize, minPoolSize, connectTimeoutMS, socketTimeoutMS, authSource as query
params) or implement a MongoClientSettingsBuilderCustomizer bean to
programmatically set MongoClientSettings (configure connectionPoolSettings and
socketSettings/connectTimeouts) so the pool/timeouts take effect.

@kkiseug kkiseug closed this Mar 3, 2026
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