Skip to content

[feat][gateway-server] AuthorizationHeaderFilter blacklist 조회 Caffeine L1 캐시 적용#19

Merged
straycat405 merged 1 commit into
devfrom
feat/18-caffeine-cache
May 19, 2026
Merged

[feat][gateway-server] AuthorizationHeaderFilter blacklist 조회 Caffeine L1 캐시 적용#19
straycat405 merged 1 commit into
devfrom
feat/18-caffeine-cache

Conversation

@straycat405

@straycat405 straycat405 commented May 19, 2026

Copy link
Copy Markdown
Contributor

🌱 설명

  • AuthorizationHeaderFilter의 Redis blacklist 조회 앞단에 Caffeine L1 캐시 추가
  • 동일 JTI 재요청(5초 이내)은 Redis 왕복 없이 메모리 조회(~100ns)로 처리

📌 관련 이슈

💻 커밋 유형

해당하는 항목에 x를 채워주세요.

  • feat : 새로운 기능 추가
  • fix : 버그 수정 (긴급 핫픽스 포함)
  • refactor : 리팩토링
  • chore : 빌드 설정, 의존성 업데이트 등
  • docs : 문서 수정
  • comment : 주석 추가 및 변경
  • rename : 파일 / 폴더 이동 또는 이름 변경
  • remove : 파일 삭제
  • test : 테스트 코드 추가 / 수정

📝 체크리스트

PR 올리기 전에 아래 항목을 확인해주세요.

  • develop 브랜치 기준으로 feature 브랜치를 생성했나요?
  • 코드 컨벤션 및 스타일 가이드를 준수했나요?
  • 관련 이슈와 연결했나요?
  • 설명이 필요한 부분 / 어려운 부분 / 공유가 필요한 부분에 주석을 추가했습니다.
  • 제가 작성한 코드를 스스로 리뷰했습니다.
  • 기존 테스트와 충돌하지 않음을 확인했나요?

📚 추가 설명

개선 배경 (Before 부하테스트 수치)

  • 테스트 조건: vuser 10→70 Ramp-Up, 7분, GET /users/me 85% + POST /auth/login 15%
  • vuser=10 MTT: 7ms → vuser=70 MTT: 46ms (535% 증가)
  • 포화 구간: MTT 54ms >> 스파이크 24회
  • 원인: 동시 Redis hasKey Mono 적체 → Lettuce 커넥션 풀 압박

개선 원리

Before: 모든 인증 요청 → Redis hasKey (~1-3ms 네트워크 왕복)
After:  동일 JTI 재요청 → Caffeine.getIfPresent() (~100ns 메모리 조회)
        초당 Redis 호출: ~1,400회 → ~14회 (99% 감소)

캐시 설계

  • maximumSize(10_000) / expireAfterWrite(5s)
  • TTL 트레이드오프: 로그아웃 후 최대 5초 지연 - AT TTL 대비 허용 범위
  • 신규 의존성 없음 (기존 Caffeine 의존성 재사용)

영향 범위

  • 이 변경은 gateway를 통과하는 모든 서비스의 인증 경로에 적용됨
  • 타 서비스 코드·API 계약 변경 없음
  • user-service의 blacklist 쓰기(SET blacklist:{jti}) 동작 변경 없음

- 매 인증 요청마다 Redis hasKey를 호출하는 구조에서,
동일 JTI 재요청은 Caffeine 로컬 캐시(TTL 5초)로 처리하도록 변경
- vuser=70 기준 GET /users/me MTT 46ms → 목표 10ms 이하
@straycat405 straycat405 self-assigned this May 19, 2026
@straycat405 straycat405 added the 💻 feature 새로운 기능 개발 label May 19, 2026
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: first-ticket/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ace047b-630a-4a5a-b61f-71b7ebdfdb3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/18-caffeine-cache

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@straycat405 straycat405 merged commit c6bf96b into dev May 19, 2026
3 checks passed
@straycat405 straycat405 deleted the feat/18-caffeine-cache branch May 19, 2026 01:51
@github-project-automation github-project-automation Bot moved this from Todo to Done in First Ticket May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 feature 새로운 기능 개발

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[feat][gateway-server] AuthorizationHeaderFilter blacklist 조회 Caffeine L1 캐시 적용

2 participants