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

Api: ✨ 분산 코디네이션 도입을 고려한 서비스 탐색 서비스 API #162

Merged
merged 9 commits into from
Oct 8, 2024

Conversation

psychology50
Copy link
Member

작업 이유

채팅 서버와 Socket 연결을 위해, Client는 1차적으로 클라이언트의 물리적 위치(geographical location)서버의 용량(capacity)을 기반으로 최적의 채팅 서버 url을 알아야 합니다.
이번 작업은 이러한 기능을 고려하여 설계되었습니다.


작업 사항

초기 설계안이라 현재 클래스명과 다소 차이가 있습니다.

우선 위 설계는 한 가지 가정을 두고 시작합니다.

  • 채팅 서버는 언제든지 유연하게 scale-out 될 수 있다.
  • API 서버는 이 채팅 서버 중, 클라이언트에게 가장 최적의 채팅 서버 url을 반환해주어야 한다.

이를 완벽하게 구현하기 위해서는 Apache Zookeeper와 같은 분산 코디네이션 서비스(Distributed Coordination Service)를 사용하겠지만, 당연히 저희는 사용하지 않습니다! 😆

단, 수요가 있을 때, 언제든지 빠르게 적용하기 위해 모듈화의 이점을 극대화하여 위와 같이 설계하게 되었습니다.

📝 API Spec

  • 요청: GET /v2/socket/chat
    • 해당 요청은 API 서버 인증 권한 검사를 수행합니다.
  • 응답
    {
        "code": "2000",
        "data": {
            "chatServerUrl": ""
        }
    }

리뷰어가 중점적으로 확인해야 하는 부분

  • URL 명이 조금 구리네요. 아름다운 이름이 없을까..

발견한 이슈

image
ChatServerSearchService를 확인하면, CoordinatorService 빈에 주입이 제대로 이루어지지 않고 있다고 나올 텐데, 이상은 없습니다.

infra 모듈의 Config 파일에 @Configuration을 사용하지 않고, 아래와 같이 의존성을 api 모듈이 제어하게 만듦으로써, IDE이 빈을 탐색하지 못할 뿐.
실제 컴파일 타입에선 문제 없이 동작합니다. ^^

@EnablePennywayInfraConfig({
        PennywayInfraConfigGroup.FCM,
        PennywayInfraConfigGroup.DistributedCoordinationConfig
})
public class InfraConfig {
}

@psychology50 psychology50 added the enhancement New feature or request label Oct 8, 2024
@psychology50 psychology50 self-assigned this Oct 8, 2024
@psychology50 psychology50 merged commit f860e57 into dev Oct 8, 2024
1 check passed
@psychology50 psychology50 deleted the feat/PW-551-service-search-service branch October 8, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant