-
Notifications
You must be signed in to change notification settings - Fork 0
[feat/#11]: Kafka 기반 Event-Driven 아키텍처를 도입하고 Non-blocking 처리를 구현한다 #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 기존 API 및 도메인 로직을 coupon-api 모듈로 이동 - Kafka Consumer 및 Worker 로직을 coupon-consumer 모듈로 분리
- coupon-consumer: Kafka Consumer, Ack-mode, Redis 설정 추가
- Redis Lua Script를 활용한 원자적 재고 검증 로직 적용 - Kafka 도입을 통한 발급 요청과 저장 로직의 비동기 처리 분리
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ PR 유형
🚀 작업 내용
Verification
k6 부하 테스트 시나리오
규모: 유저 10,000명 (VU 200명이 각각 50명씩 대행) / 부하: 총 30,000 요청 (1인당 3회 '따다닥' 연속 전송)
Kafka 기반의 Event-Driven 아키텍처 전환
Problem & Analysis
Solution
Kafka를 활용한 발급-저장 로직의 분리
→ Kafka Producer의 linger.ms와 batch.size 설정을 튜닝하여, 즉시 전송하지 않고 메모리 버퍼에 일정량을 모아서 보내는 배치 전송 방식 적용
→ Fetch해 온 메시지들을 단건 쿼리가 아닌, JDBC Bulk Insert(Batch Update) 방식을 사용하여 하나의 트랜잭션으로 묶어서 DB에 반영. DB 입장에서 비용이 큰 트랜잭션 커밋 횟수를 줄여 쓰기 처리량을 극대화(QPS 최대 175로 감소)
Result
지속적인 파라미터 튜닝을 시도했으나, 처리량이 급증함에 따라 CPU 리소스가 임계치(100%)에 도달하여 포화 상태가 지속
💬 기타 사항 or 추가 코멘트