feat: 다중 애플리케이션 인스턴스와 Nginx Failover 구성 - #17
Merged
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.
변경 사항
Snowflake 다중 인스턴스 검증
두 애플리케이션에 서로 다른 nodeId를 할당하고
Nginx를 통해 동시 생성 요청을 전달했다.
테스트 과정에서 Docker 환경의 시스템 시간이 일시적으로 역행하는
Clock Rollback을 확인했다.
이전 timestamp로 ID를 생성하지 않고 작은 시간 역행에서는
시계가 마지막 생성 시각까지 복구되기를 제한된 시간 동안 기다리도록 처리했다.
큰 시간 역행은 ID 중복 위험을 방지하기 위해 실패 처리한다.
Failover 실험
100 VU로 GET Redirect 요청을 지속하면서 App1을 중단하고 다시 실행했다.
결과
App1 장애 중 Prometheus
up값이 0으로 변경됐고,App2가 단독으로 요청을 처리했다.
App1이 중단된 상태에서도 전체 요청 실패율 0%를 유지했으며,
App1 복구 후 다시 요청 처리에 참여하는 것을 확인했다.
설계 판단
POST 생성 요청은 upstream에서 처리된 이후 응답만 유실될 경우
다른 App으로 자동 재시도하면 중복 생성 가능성이 있다.
따라서 Nginx의 장애 시 자동 재시도는 멱등한 GET 리다이렉트 요청을 중심으로 적용했다.
한계