쿠폰 발급 시 데드락 발생 #25
eggnee
started this conversation in
Issue tracking
Replies: 3 comments
-
|
일단 |
Beta Was this translation helpful? Give feedback.
0 replies
-
문제 발생
문제 해결 시도
기술 질문 키워드
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
완전 잘못 생각했다! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
1. 시나리오: 쿠폰 발급 로직
목표: 100명의 사용자가 동시에 동일한 쿠폰을 발급받는 상황에서 동시성 문제가 발생하는지 테스트
쿠폰 발급 로직:
coupon)의 잔여 수량을 감소시킴issued_coupon) 테이블에 발급된 쿠폰 데이터를 INSERT테스트 세부 사항:
조건:
coupon)의 잔여 수량은100으로 설정예상 결과:
issued_coupon) 테이블에 100개의 데이터가 생성되어야 함coupon)의 잔여 수량이 0이 아니어야 함 (동시성 문제 발생 확인)2. 테스트 중 발생한 문제
3. 원인 분석
(1) MySQL의 잠금 메커니즘
REPEATABLE READ)에 따라 레코드에 자동으로 락이 설정됨(2) JPA의 쓰기 지연
4. 데드락 발생 과정
결론
Beta Was this translation helpful? Give feedback.
All reactions