-
Notifications
You must be signed in to change notification settings - Fork 2
Load-Balancer 서버 구현 #5
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
Merged
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
0f18228 to
0158fd8
Compare
fru1tworld
added a commit
that referenced
this pull request
Jan 22, 2025
This reverts commit 8916395.
Merged
fru1tworld
added a commit
that referenced
this pull request
Jan 22, 2025
fru1tworld
added a commit
that referenced
this pull request
Jan 22, 2025
fru1tworld
added a commit
that referenced
this pull request
Jan 22, 2025
* docs: 리드미 링크 수정 (#6) * Wesocket서버 및 API 서버 분리 (#3) * fix: api 서버와 websocket 분리를 위해 backend 서버 네임 변경 * feature/split api websocket * fix: 분리 후 중복되는 코드 삭제 * Load-Balancer 서버 구현 (#5) * fix: api 서버와 websocket 분리를 위해 backend 서버 네임 변경 * feature/split api websocket * fix: 분리 후 중복되는 코드 삭제 * fix: 불필요한 파일 삭제 및 하위 subTree connection 연결되어있는 경우 저장되는 오류 해결 * feat: load-balancer server 초기 세팅 nest 생성 redis container 설정 docker-compose 수정 * fix: 하위 subTree 삭제됐는데 note를 생성할 수 있는 로직 수정 * fix: 삭제된 트리에서 노트가 생성되던 문제 해결 및 Validation 계층추가로 결합도 낮추기 * feat: redis 환경 설정 및 연결 여부 확인 * feat: load-balancer server && WebSocket Server 분산 작업 및 docker-compose 작업 * fix: url 주소 변경됨에 따라 urlParse 로직 일부 수정 * fix: room2 연결 안되던 문제 해결 * fix: cron이 작동하지 않는 문제 해결 * feat: lb-server 기능 개발 * fix: lb-server key값 수정 * feat: load-balancer 로직 구현 * feat: lb 요청 로직 추가 * fix: lb 요청 로직 비동기로 작동하도록 수정 * fix: window 상에서 redis 포트 사용 불가로 docker-compose override 수정 * fix: 웹소켓 연결 시 순환참조 수정 * fix: note 생성 요청에 spaceId 추가 * fix: validation 검증 로직 수정 * feat: 노트 에디터 로드밸런싱 로직 적용 --------- Co-authored-by: Byeongju Park <badmuxi@gmail.com> * Revert "Load-Balancer 서버 구현 (#5)" This reverts commit 8916395. --------- Co-authored-by: Byeongju Park <badmuxi@gmail.com>
fru1tworld
added a commit
that referenced
this pull request
Jan 22, 2025
* fix: api 서버와 websocket 분리를 위해 backend 서버 네임 변경 * feature/split api websocket * fix: 분리 후 중복되는 코드 삭제 * fix: 불필요한 파일 삭제 및 하위 subTree connection 연결되어있는 경우 저장되는 오류 해결 * feat: load-balancer server 초기 세팅 nest 생성 redis container 설정 docker-compose 수정 * fix: 하위 subTree 삭제됐는데 note를 생성할 수 있는 로직 수정 * fix: 삭제된 트리에서 노트가 생성되던 문제 해결 및 Validation 계층추가로 결합도 낮추기 * feat: redis 환경 설정 및 연결 여부 확인 * feat: load-balancer server && WebSocket Server 분산 작업 및 docker-compose 작업 * fix: url 주소 변경됨에 따라 urlParse 로직 일부 수정 * fix: room2 연결 안되던 문제 해결 * fix: cron이 작동하지 않는 문제 해결 * feat: lb-server 기능 개발 * fix: lb-server key값 수정 * feat: load-balancer 로직 구현 * feat: lb 요청 로직 추가 * fix: lb 요청 로직 비동기로 작동하도록 수정 * fix: window 상에서 redis 포트 사용 불가로 docker-compose override 수정 * fix: 웹소켓 연결 시 순환참조 수정 * fix: note 생성 요청에 spaceId 추가 * fix: validation 검증 로직 수정 * fix: deploy q * Revert 5 feature/load balancer (#10) * docs: 리드미 링크 수정 (#6) * Wesocket서버 및 API 서버 분리 (#3) * fix: api 서버와 websocket 분리를 위해 backend 서버 네임 변경 * feature/split api websocket * fix: 분리 후 중복되는 코드 삭제 * Load-Balancer 서버 구현 (#5) * fix: api 서버와 websocket 분리를 위해 backend 서버 네임 변경 * feature/split api websocket * fix: 분리 후 중복되는 코드 삭제 * fix: 불필요한 파일 삭제 및 하위 subTree connection 연결되어있는 경우 저장되는 오류 해결 * feat: load-balancer server 초기 세팅 nest 생성 redis container 설정 docker-compose 수정 * fix: 하위 subTree 삭제됐는데 note를 생성할 수 있는 로직 수정 * fix: 삭제된 트리에서 노트가 생성되던 문제 해결 및 Validation 계층추가로 결합도 낮추기 * feat: redis 환경 설정 및 연결 여부 확인 * feat: load-balancer server && WebSocket Server 분산 작업 및 docker-compose 작업 * fix: url 주소 변경됨에 따라 urlParse 로직 일부 수정 * fix: room2 연결 안되던 문제 해결 * fix: cron이 작동하지 않는 문제 해결 * feat: lb-server 기능 개발 * fix: lb-server key값 수정 * feat: load-balancer 로직 구현 * feat: lb 요청 로직 추가 * fix: lb 요청 로직 비동기로 작동하도록 수정 * fix: window 상에서 redis 포트 사용 불가로 docker-compose override 수정 * fix: 웹소켓 연결 시 순환참조 수정 * fix: note 생성 요청에 spaceId 추가 * fix: validation 검증 로직 수정 * feat: 노트 에디터 로드밸런싱 로직 적용 --------- Co-authored-by: Byeongju Park <badmuxi@gmail.com> * Revert "Load-Balancer 서버 구현 (#5)" This reverts commit 8916395. --------- Co-authored-by: Byeongju Park <badmuxi@gmail.com> --------- Co-authored-by: Byeongju Park <badmuxi@gmail.com>
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.
✏️ 한 줄 설명
✅ 작업 내용
🏷️ 관련 이슈
📸 스크린샷/영상
📌 리뷰 진행 시 참고 사항
확장 가능한 서비스를 위한 Load-Balancer 서버 구현
현재 API, WebSocket, LB-Server로 구성되어있습니다.
WebSocket 서버 흐름은 다음과 같습니다.
connection 연결 connection 카운트 증가, redis 반영
전체 커넥션 해제, redis key값 삭제
key값 ws:connection:${serverId}
10초 간격으로 주기적으로 cpu 사용량을 redis에 업데이트
WebSocket 서버 정리
Load-Balancer Server 흐름
Redis 구성
CPU 사용량을 조회할 때는 최소값만 알면되므로 ZSet(Sorted Set) 사용
WebSocket Connection 정보를 관리할 때는 단순히 get/set 사용
Container 구성
흐름의 주체는 결국 CPU의 코어
현재 NCP는 코어가 2개로 실행 중
docker-container에서는 특정 컨테이너가 특정 core에서 실행될 수 있도록 설정 작업
관련 작업은 이후 반영 예정
수정 필요한 부분 :