[refactor/#660] FCM 외부 호출을 트랜잭션 밖으로 분리해 DB 커넥션 점유 병목 해결#661
Open
kanghana1 wants to merge 3 commits into
Open
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
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.
❤️ 기능 설명
스레드풀 분리 후 성능이 나빠져 모니터링을 해본 결과 병목 원인은 스레드가 아닌 FCM(외부 I/O) 호출이 DB 커넥션(HikariCP)을 점유하는 것이었음. 이를 해결하기 위해 FCM 호출을 트랜잭션 밖으로 빼 커넥션 점유를 제거
변경 사항
NotificationEventListener):@Transactional(REQUIRES_NEW)제거 →findById는 리포지토리 자체 트랜잭션으로 커넥션을 짧게 잡았다 반납, FCM은 커넥션 없이 실행ChatPushNotificationService):@Transactional(readOnly)제거 → fetch join(...WithMember)으로 멤버 로딩 후, detached 상태에서 FCM 루프 실행연결된 issue
연결된 issue를 자동으로 닫기 위해 아래 {이슈넘버}를 입력해주세요.
close #660
🩷 Approve 하기 전 확인해주세요!
✅ 체크리스트