Skip to content

[Test] Embedding Job Claim 처리량·경합 Benchmark - #62

Merged
Gimini-3 merged 2 commits into
developfrom
test/61
Jul 26, 2026
Merged

[Test] Embedding Job Claim 처리량·경합 Benchmark#62
Gimini-3 merged 2 commits into
developfrom
test/61

Conversation

@Gimini-3

@Gimini-3 Gimini-3 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

🔍️ 작업 내용

✨ 상세 설명

  • 실제 EmbeddingJobClaimService를 Worker 1·5·10·20·40으로 동시에 호출하는 OpenSQL Benchmark를 추가했습니다.
  • Profile마다 Job 5,000개를 5회 실행하며 TPS, p50·p95·p99·최대 지연과 Worker별 Claim 분포를 기록합니다.
  • Hikari Pool MXBean과 별도 PostgreSQL Monitoring Connection으로 Connection 대기와 Lock 대기를 수집합니다.
  • 모든 Profile에서 Job ID, Worker, Claim Token, Lease, 최종 상태, LOCKED 이벤트 정합성을 다시 검증합니다.
  • claimPerformanceTest 전용 Gradle Task를 추가했으며 기본 testbuild에서는 Benchmark를 제외합니다.
  • Production Java, Flyway Migration, Application 설정은 변경하지 않았습니다.

검증

  • ./gradlew testClasses 성공
  • 작은 Profile claimPerformanceTest 성공
  • ./gradlew test 성공
  • ./gradlew claimConcurrencyTest 성공
  • 기본값 ./gradlew claimPerformanceTest 성공 — 25개 Profile, 측정 Job 125,000개, 4분 20초
  • ./gradlew build 성공

기준선 요약

  • Worker 5: 중앙 1,300.58 TPS, p99 6.19ms, Hikari 대기 없음
  • Worker 10: 중앙 1,301.34 TPS, p99 18.58ms
  • Worker 20: 중앙 1,265.59 TPS, p99 39.14ms
  • Worker 40: 중앙 1,559.80 TPS, p99 97.63ms, Hikari 대기 최대 20개
  • 전체 Profile Worker 오류·Rollback·Deadlock·Queue 누락·Token 중복 0
  • 상세 환경과 반복 결과: docs/test-results/gimin-#61-embedding-job-claim-performance.md

🛠️ 추후 리팩토링 및 고도화 계획

  • 고정 CI Runner와 반복 기준선이 준비되면 상대 성능 회귀 Gate를 별도 검토합니다.
  • Worker 자동 Polling 구현 시 Worker 5를 시작 후보로 사용하고 전체 인덱싱 처리량과 Tail latency를 다시 측정합니다.
  • 재시도 예약 또는 만료 Lease 회수가 Queue 조건에 추가되면 동일 Profile 기준선을 갱신합니다.

📸 스크린샷 (선택)

  • JUnit HTML Report: build/reports/tests/claimPerformanceTest/index.html

💬 리뷰 요구사항

  • Worker 5 이후 처리량 증가보다 p99 상승이 큰 변곡점 해석이 적절한지 확인 부탁드립니다.
  • PostgreSQL 14 누적 Commit 통계는 Monitoring·경계 조회 Transaction을 포함해 관찰값으로만 기록한 점을 확인 부탁드립니다.

Summary by CodeRabbit

  • 새 기능

    • Embedding Job Claim 처리량과 동시성 경합을 측정하는 성능 벤치마크를 추가했습니다.
    • 워커 수별 처리량, 지연 시간, 데이터 정합성, 데이터베이스 잠금 및 커넥션 대기 상태를 측정합니다.
    • 반복 실행 결과와 중앙값을 JSON 및 문서로 기록해 성능 추이를 비교할 수 있습니다.
  • 문서

    • 벤치마크 설계, 측정 기준, 실행 절차 및 결과를 문서화했습니다.
    • 다양한 워커 규모와 실행 환경에서 결과를 재현하는 방법을 추가했습니다.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c80b1a48-3fec-4f9b-90b2-b5eee0e880e9

📥 Commits

Reviewing files that changed from the base of the PR and between a8d75d5 and cef1451.

📒 Files selected for processing (4)
  • build.gradle
  • docs/design/embedding-job-claim-performance-benchmark.md
  • docs/test-results/gimin-#61-embedding-job-claim-performance.md
  • src/test/java/com/opensource/docgrid/domain/embedding/benchmark/EmbeddingJobClaimPerformanceBenchmark.java

📝 Walkthrough

Walkthrough

claimPerformanceTest Gradle 태스크와 다중 Worker 기반 EmbeddingJobClaimService Benchmark를 추가했습니다. Claim 처리량·지연·Hikari/PostgreSQL 대기·정합성을 측정하고, 설계 문서와 실행 결과·재현 절차를 기록합니다.

Changes

Embedding Job Claim 성능 Benchmark

Layer / File(s) Summary
Benchmark 계약과 실행 진입점
build.gradle, docs/design/..., src/test/java/.../EmbeddingJobClaimPerformanceBenchmark.java
claim-performance 태그 전용 Gradle 태스크와 Benchmark 설계 기준을 추가하고, 전용 DB 환경 검증·warm-up·프로필 실행 흐름을 구성합니다.
데이터 시드와 동시 Claim 실행
src/test/java/.../EmbeddingJobClaimPerformanceBenchmark.java
측정용 Job과 Worker를 시드한 뒤 공통 시작 게이트에서 여러 Worker가 Claim을 반복 호출하며, Hikari와 PostgreSQL Lock 대기를 샘플링합니다.
정합성 검증과 통계 집계
src/test/java/.../EmbeddingJobClaimPerformanceBenchmark.java
Claim 소유권·상태·이벤트 정합성을 검증하고, latency percentile·처리율·Worker 분포·DB 대기 및 트랜잭션 지표를 JSON 요약으로 생성합니다.
결과 기록과 재현 절차
docs/test-results/...
실행 환경, Profile별 결과, 자동 실패 조건, 검증 명령, 격리 DB 구성과 재현 절차를 기록합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Gradle
  participant Benchmark
  participant ClaimService
  participant Hikari
  participant PostgreSQL
  Gradle->>Benchmark: claim-performance 테스트 실행
  Benchmark->>PostgreSQL: Job 및 Worker 데이터 시드
  Benchmark->>Hikari: Worker 연결 획득
  Benchmark->>ClaimService: claim(workerId) 반복 호출
  ClaimService->>PostgreSQL: PENDING Job Claim 및 LOCKED 이벤트 기록
  Benchmark->>PostgreSQL: Lock 대기와 정합성 상태 조회
  Benchmark-->>Gradle: Profile 결과 및 중앙값 JSON 로깅
Loading

Possibly related PRs

  • DocGrid/backend#49: Lease와 SKIP LOCKED 기반 Claim 계약을 이 Benchmark가 직접 호출하고 검증합니다.
  • DocGrid/backend#53: 동일한 EmbeddingJobClaimService.claimPENDING/LOCKED 흐름을 대상으로 다중 Worker 테스트를 추가합니다.

Suggested labels: ✨ Feature

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/61

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.

@Gimini-3
Gimini-3 marked this pull request as ready for review July 26, 2026 07:57
@Gimini-3
Gimini-3 merged commit bd441f3 into develop Jul 26, 2026
1 check passed
@Gimini-3 Gimini-3 self-assigned this Jul 26, 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.

[Test] Embedding Job Claim 처리량·경합 Benchmark

1 participant