Skip to content
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

[Refactor] #294 - Redis 유저 조회 로직 개선 #295

Merged
merged 6 commits into from
Jul 2, 2024
Merged

Conversation

its-sky
Copy link
Member

@its-sky its-sky commented Jul 2, 2024

🚀PullRequest🚀

📟 관련 이슈

💻 작업 내용

  • Security 로그인 로직 중에서 UserDetails에 유저를 Redis에서 조회하여 주입하고 이를 커스텀 어노테이션에서 사용하는 로직이 존재하였습니다. 하지만 Access Token의 userId만을 주입하여 사용하여도 충분히 문제없는 로직이었습니다. 따라서 Redis에서 유저를 조회하여 UserDetails에 삽입하는 로직을 제거하고 JMeter로 성능 테스트를 진행하였습니다.
  • JwtTokenProvider와 UserService에서 제대로 동작하지 않거나 불필요한 검증 로직 및 조회 로직을 삭제하였습니다.
  • UserService에서 사용되는 userService.findByIduserService.findByIdWithCache를 이용하여 Redis에 캐싱되어 있는 유저 정보를 사용하여 처리하도록 하였습니다.

📝 리뷰 노트

[JMeter 성능 테스트 - 기존 Redis 로직이었을 때 in Local]
스크린샷 2024-07-02 오후 2 51 46

[JMeter 성능 테스트 - Redis 조회 로직을 제거했을 때 in Local]
스크린샷 2024-07-02 오후 2 54 08

로컬에서 테스트를 진행하였을 때 조회 API 10만 건에서 평균 13ms에서 11ms로 개선되었음을 확인하였습니다. 저희 서버 인프라 상 싱글 코어인만큼 성능 차이는 더 확연히 벌어질 것이라고 생각합니다.

모르는 부분이 있거나 이상한 점은 코드리뷰에 달아주세요 감사합니다 :)

@its-sky its-sky requested a review from 0lynny July 2, 2024 06:29
@its-sky its-sky self-assigned this Jul 2, 2024
Copy link
Member

@0lynny 0lynny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어푸룹 했습니다 !

@its-sky its-sky merged commit 5459509 into develop Jul 2, 2024
1 check passed
@its-sky its-sky deleted the feature/#294 branch July 2, 2024 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] Redis 유저 조회 로직 개선
2 participants