You've already forked FrameTour-BE
chore(threadpool): 调整人脸识别线程池配置
- 将核心线程数从32增加到128 - 将最大线程数从128增加到256 - 将空闲线程存活时间从60秒减少到10秒 - 将任务队列容量从1000调整为1024
This commit is contained in:
@@ -19,19 +19,19 @@ public class FaceRecognitionThreadPoolConfig {
|
||||
|
||||
/**
|
||||
* 创建人脸识别专用线程池
|
||||
* - 核心线程数:32
|
||||
* - 最大线程数:128
|
||||
* - 核心线程数:128
|
||||
* - 最大线程数:256
|
||||
* - 队列容量:1000(避免无限制增长)
|
||||
* - 拒绝策略:CallerRunsPolicy(调用者线程执行)
|
||||
*/
|
||||
@Bean(name = "faceRecognitionExecutor", destroyMethod = "shutdown")
|
||||
public ThreadPoolExecutor faceRecognitionExecutor() {
|
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(
|
||||
32, // 核心线程数
|
||||
128, // 最大线程数
|
||||
60L, // 空闲线程存活时间
|
||||
128, // 核心线程数
|
||||
256, // 最大线程数
|
||||
10L, // 空闲线程存活时间
|
||||
TimeUnit.SECONDS, // 时间单位
|
||||
new LinkedBlockingQueue<>(1000), // 任务队列
|
||||
new LinkedBlockingQueue<>(1024), // 任务队列
|
||||
r -> {
|
||||
Thread thread = new Thread(r);
|
||||
thread.setName("face-recognition-" + thread.getId());
|
||||
|
||||
Reference in New Issue
Block a user