전략평가 개선

This commit is contained in:
Macbook
2026-06-05 12:22:29 +09:00
parent 0aaf4ac19c
commit e0ef5845a2
5 changed files with 390 additions and 83 deletions
@@ -26,4 +26,30 @@ public class TrendSearchSchedulerConfig {
ex.initialize();
return ex;
}
/**
* [항목4] BarBuilder Phase 2 전략 평가 전용 스레드 풀.
*
* <p>업비트 WebSocket 수신 스레드가 분봉 마감 시 전략 평가 연산에 블로킹되지 않도록
* Phase 2(전략 평가 트리거)를 별도 스레드로 분리한다.
*
* <p>소규모(20~30인) 환경 기준:
* <ul>
* <li>corePoolSize=2: 여러 마켓의 분봉이 동시 마감되어도 2개 스레드로 병렬 처리</li>
* <li>maxPoolSize=4: 순간 피크(예: 매시 00분 1m/5m/15m/1h 동시 마감) 대응</li>
* <li>queueCapacity=32: 밀린 평가 작업을 드롭 없이 큐잉</li>
* </ul>
*/
@Bean(name = "barCloseEvalExecutor")
public Executor barCloseEvalExecutor() {
ThreadPoolTaskExecutor ex = new ThreadPoolTaskExecutor();
ex.setThreadNamePrefix("bar-close-eval-");
ex.setCorePoolSize(2);
ex.setMaxPoolSize(4);
ex.setQueueCapacity(32);
ex.setWaitForTasksToCompleteOnShutdown(true);
ex.setAwaitTerminationSeconds(60);
ex.initialize();
return ex;
}
}