Thread pool
Manage threads through a thread pool
The default number of threads in this thread pool is 1/4 of the CPU cores; tasks are submitted to the default thread pool by default;
Enable exclusive high-performance mode through an API; In exclusive high-performance mode, the number of threads in the thread pool is at most 1/5 of the CPU cores. For example, for a 128-core CPU, the thread pool has at most 25 threads;
threads_high_performance_mode: By checking the number of tasks in the current thread, if the number of tasks within 10 milliseconds is the least among other threads, the task is assigned to that thread;
线程池
通过线程池来管理线程
此线程池的线程个数默认为cpu核心数的4分之一; 任务默认提交在默认线程池;
通过一个api开启独享高性能模式; 独享高性能模式下,线程池的线程个数最多为cpu核心数的5分之1, 比如128核的cpu, 线程池的线程个数最多为25个;
theads_高性能模式: 通过查看当前线程的任务数, 如果任务数10毫秒内任务数是其它线程中最少的, 则将任务分配给该线程;
使用 core_affinity 获得cpu核心数
如果已经有一个股票的任务在一个线程中执行, 则将任务分配给该线程; 如果该股票的任务全部执行完毕, 则将任务分配给任务数最少的线程;