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

Feat/#137 MultiQueue를 이용하여 Controller에서 오는 로그 요청의 부하 감소 #138

Closed
wants to merge 17 commits into from

Conversation

miiiinju1
Copy link
Member

🚀 작업 내용

  • 현재 아키텍처에서, 싱글 스레드 - 큐 - 싱글스레드 쌍을 수평확장할 수 있도록 구현했습니다.
  • 현재 한 클래스 내에 모두 섞여있는데, 추후 리팩토링이 시급합니다.
  • RPS가 350정도로 개선되었고, 초당 약 35000개의 로그 처리가 가능합니다.

📸 이슈 번호

👀 Focus Commits [Optional]

  • 커밋해시: 내용

✍ 궁금한 점

  • 중점적으로 봐줄 내용
  • 변수명 괜찮나요
  • 로직이 좀 더럽나요
  • 가독성이 좀 그런가요?

miiiinju1 and others added 17 commits August 27, 2024 20:51
- consume() 메서드에 대해 consumeLock 객체를 사용한 동기화 구현
- produce() 메서드의 동기화 제거로 불필요한 락킹 방지
- consume() 메서드의 대기 로직을 do-while 루프로 변경하여 spurious wakeup 방지
- produce() 메서드에서 consumeLock.notify() 호출로 정확한 스레드 깨우기
- 전반적인 동시성 처리 개선으로 생산자와 소비자 간 효율성 향상
- LockSupports를 활용한 Thread lock방식을 적용했습니다.
- `volatile Thread consumerThread`에 대한 VarHandle을 적용했습니다.
- Producer, Consumer 방식을 적용해 리팩토링을 진행했습니다.
- 이에 따라 사용하지 않는 테스트를 Deprecated 처리했습니다.
- LogQueue에 대한 Java-Doc을 추가했습니다.
- 사용하지 않는 메서드에 대한 Deprecated 처리를 진행했습니다.
- AsyncLogProcessor에 대한 JavaDoc를 작성했습니다.
- `Consumer` -> `EventConsumer`, `Producer` -> `EventProducer` 이름 변경을 진행했습니다.
- 패키지 위치를 변경했습니다.
- Deprecated 된 테스트를 제거했습니다.
- volatile 키워드 로 충분히 가시성이 보장
- 임시로 여러 큐를 가지는 MultiProcessor를 추가함
@miiiinju1 miiiinju1 requested review from LuizyHub and tidavid1 and removed request for LuizyHub August 29, 2024 01:06
Copy link

Risk Level 3 - /home/runner/work/Team5-Guys/Team5-Guys/logbat/src/main/java/info/logbat/domain/log/queue/ReentrantLogQueue.java

  1. The use of ReentrantLock is appropriate, but ensure that the lock is always released in a finally block to prevent deadlocks.
  2. Consider adding a timeout to the await() method to avoid indefinite waiting.

Risk Level 3 - /home/runner/work/Team5-Guys/Team5-Guys/logbat/src/main/java/info/logbat/domain/log/queue/LogQueue.java

  1. The use of LockSupport.parkNanos(timeoutNanos); can lead to potential deadlocks if not handled properly. Ensure that the timeout is set correctly.
  2. Consider adding a timeout mechanism to avoid indefinite blocking in the consume() method.

Risk Level 3 - /home/runner/work/Team5-Guys/Team5-Guys/logbat/src/main/java/info/logbat/domain/log/repository/MultiProcessor.java

  1. The use of ThreadLocalRandom is good for reducing contention, but ensure that the queues are properly initialized before use.
  2. Consider adding error handling in the leaderTask() method to manage exceptions during log processing.

🔒⚠️🛠️


Powered by Code Review GPT

@tidavid1 tidavid1 closed this Aug 29, 2024
@tidavid1 tidavid1 deleted the feat/#137 branch August 29, 2024 01:20
@tidavid1
Copy link
Member

Git Conflict 제거 및 플로우 일원화를 위한 삭제

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants