Repository navigation
[Volume-10] 주간/월간 랭킹 배치 - #456
kimsungho93 wants to merge 18 commits into
Conversation
|
Important Review skippedToo many files! This PR contains 121 files, which is 21 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (124)
You can disable this status message by setting the 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. Comment |
아래 내용을 그대로 PR에 붙여 넣으면 됩니다. 구현 완료와 향후 과제를 명확히 구분했습니다.
🧭 Context & Decision
문제 정의
product_metrics는 상품별 누적값만 저장해 특정 주간·월간의 지표를 다시 계산할 수 없었다.product_metrics를 상품별 일간 집계 SOT로 전환한다.선택지와 결정
(metric_date, product_id)단위의 일간 지표를 저장하고 기간별로 다시 집계한다.product_idKeyset과(product_id, metric_date)인덱스를 함께 사용한다.ResourcelessJobRepository를 사용하고 실패 시 전체를 다시 집계한다.JobRepository에 실행 이력과 Chunk 체크포인트를 저장한다.product_metrics를 이벤트 발생일 기준의 일간 집계 SOT로 변경했다.period,aggregationEndDate,revision을 식별 파라미터로 사용하는productRankingSnapshotJob을 구성했다.completed_at갱신을 하나의 트랜잭션으로 처리한다.product_rank_candidates, 공개 Top 100은 주간·월간 MV에 분리했다.period가 없으면 기존 DAILY를 사용하고, WEEKLY·MONTHLY는 요청 날짜가 속한 기간의 최신 완료 Snapshot을 조회한다.revision을 증가시킨다.productRankingCleanupJob으로 구현했다.revision으로 수동 재집계한다.STARTED상태가 남는 상황의 자동 복구는 운영 환경이 정해진 뒤 별도 Runbook으로 검증한다.🤔 고민한 점 / 막혔던 부분
product_rank_candidates와 Snapshot의completed_at을 사용해 계산 결과와 공개 결과의 책임을 분리했다.GROUP BY가 포함되면서 다음 페이지마다 남은 상품 전체를 반복 집계해 약 17분이 걸렸다.(product_id, metric_date)인덱스를 함께 적용해야 효과가 있었다.1,000 / 5,000 / 10,000을 반복 측정했다. 처리시간 차이가 크지 않아 처리량보다 재시작 안정성을 우선하여 1,000을 선택했다.ResourcelessJobRepository의 단순함과 JDBC JobRepository의 재시작 안정성을 비교했다. 향후 데이터 증가와 실행 후반 장애를 고려해 JDBC 방식을 유지했다.🙋 기타
product_metrics2,260,000행, 활성 상품 400,000개, 월간 31일 Dataset으로 검증했다.1,023.0712초 → 72.7506초약 960.99초 → 약 11.81초61.2212초, 공개 MV 100행, 롤백 0건을 확인했다.