Feat/kafka-setting: 트랜잭션 락 최소화를 위한 성능 개선 - #27
Open
jhlee0409 wants to merge 10 commits into
Open
Conversation
omizha
reviewed
Feb 13, 2025
| @@ -0,0 +1,37 @@ | |||
| services: | |||
Collaborator
There was a problem hiding this comment.
docker-compose.yml 파일은 docker폴더 안에 두는 것 보다
루트폴더에 두는게 좋을듯 해요.
GPT 피셜
- 표준 관행: Docker Compose 파일은 일반적으로 프로젝트의 루트 디렉토리나 서비스 디렉토리의 바로 아래에 위치하는 것이 일반적입니다.
- 단순성: 불필요한 중첩 디렉토리를 제거함으로써 프로젝트 구조가 더 단순해집니다.
- 접근성: 다른 개발자들이 프로젝트를 살펴볼 때 docker-compose.yml 파일을 더 쉽게 찾을 수 있습니다.
- 명령어 실행의 편의성: docker-compose 명령을 실행할 때 별도의 경로 지정 없이 더 쉽게 실행할 수 있습니다.
jhlee0409
marked this pull request as ready for review
March 7, 2025 20:47
omizha
reviewed
Mar 8, 2025
| environment: | ||
| - DYNAMIC_CONFIG_ENABLED=true | ||
| - KAFKA_CLUSTERS_0_NAME=koi_kafka | ||
| - KAFKA_CLUSTERS_0_NAME=stock-service |
omizha
reviewed
Mar 8, 2025
| PollModule, | ||
| StockModule, | ||
| PartyModule, | ||
| KafkaModule.forRootAsync({ |
Collaborator
There was a problem hiding this comment.
feature-nest-stock 에서 KafkaModule.forFeature 쓸 수 있을까요?
omizha
reviewed
Mar 8, 2025
| private readonly logger = new Logger(KafkaService.name); | ||
|
|
||
| private kafka = new Kafka({ | ||
| brokers: ['localhost:9094'], |
Collaborator
There was a problem hiding this comment.
환경변수로 브로커 주소 받아주세요
lib-nest-kafka 로 재사용 가능하게 구성한다면 options.broker 입력 받아주세요
omizha
reviewed
Mar 8, 2025
| inject?: Array<Type<unknown> | string | symbol | Abstract<unknown> | Function>; | ||
| } | ||
|
|
||
| @Module({ |
Collaborator
There was a problem hiding this comment.
KafkaModule을 package/library/lib-nest-kafka 로 옮길 수 있을까요?
omizha
reviewed
Mar 8, 2025
| imports: [MongooseModule.forFeature([{ name: Outbox.name, schema: OutboxSchema }]), KafkaModule], | ||
| providers: [OutboxRepository, OutboxProcessor, OutboxService], | ||
| }) | ||
| export class OutboxModule {} |
Collaborator
There was a problem hiding this comment.
아웃박스 패턴이 무엇인지 주석이나 README.md 가 필요할 것 같아요
omizha
reviewed
Mar 8, 2025
| constructor(private readonly outboxService: OutboxService, private readonly kafkaService: KafkaService) {} | ||
|
|
||
| @Cron(CronExpression.EVERY_5_SECONDS) | ||
| async processOutboxMessages(): Promise<void> { |
Collaborator
There was a problem hiding this comment.
이 함수가 무엇인지 더 자세히 적을 필요가 있을듯 해요!
Cron을 5초마다 걸어둔 배경도 궁금해요 (주석으로)
omizha
reviewed
Mar 8, 2025
| async setStockPhase(stockId: string, phase: StockPhase): Promise<Stock> { | ||
| if (phase === 'INTRO_RESULT') { | ||
| await this.userService.alignIndexByOpenAI(stockId); | ||
| await this.userService.alignIndex(stockId); |
omizha
reviewed
Mar 8, 2025
| - DYNAMIC_CONFIG_ENABLED=true | ||
| - KAFKA_CLUSTERS_0_NAME=koi_kafka | ||
| - KAFKA_CLUSTERS_0_NAME=stock-service | ||
| - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9092 |
Collaborator
There was a problem hiding this comment.
저희 카프카 서버 9092와 9094 서버의 차이가 무엇인가요? 각자 역할이 뭔지 궁금해요
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.
🚀 트랜잭션 락 방지를 위한 아웃박스 패턴 도입
📝 변경 사항
🔍 배경
📊 개선 효과
🛠️ 구현 내용
📋 확인 사항