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