摘要
在数字社会对强算力的要求下,为使CPU性能最大化,需要使用线程池来提高CPU并行计算能力,然而在开发中线程池的使用往往伴随着线程池状态混乱以及难以监控的问题。针对该问题,本文提出了一种基于实时监控的动态调节线程池方法。该方法通过实时监控线程池参数,动态调整核心线程数与最大线程数的数量来规避由于线程资源的配置不足导致业务故障的问题;引入监控中心与报警中心模块,以便直观监测线程池的执行状态、线程数量、队列容量等来实现实时监控。引入配置中心模块实时同步修改线程池的参数,快速的调整线程池参数并同步到线程池中。实验结果表明,本文所提出的方法能有效的动态调节线程池,缓解线程池状态与任务混乱的问题。
Under the requirement of strong computing power in digital society,in order to maximize CPU performance,it is necessary to use thread pools to improve CPU parallel computing capability,however,the use of thread pools in development is often accompanied by the problem of chaotic thread pool status and difficult to monitor.In order to address this problem,this paper proposes a method for dynamically adjusting the thread pool based on real-time monitoring.The method dynamically adjusts the number of core threads and the maximum number of threads by monitoring the thread pool parameters in real time to avoid the problem of business failures due to insufficient configuration of thread resources;introduces a monitoring center and an alarm center module in order to visually monitor the execution state of the thread pool,the number of threads,the capacity of the queue and so on to achieve real-time monitoring.The configuration center module is introduced to synchronously modify the parameters of the thread pool in real time,so as to quickly adjust the thread pool parameters and synchronize them to the thread pool.Experimental results show that the method proposed in this paper can effectively adjust the thread pool dynamically and alleviate the problem of thread pool state and task confusion.
作者
涂小妹
闫东升
TU Xiaomei;YAN Dongsheng(College of Civil Engineering and Architecture,Zhejiang Guangsha Vocational and Technical University of Construction,Dongyang 322100,Zhejiang,China;Hangzhou Weiyi Information Technology Co.,Ltd,Hangzhou 310018,China)
出处
《智能计算机与应用》
2024年第9期76-81,共6页
Intelligent Computer and Applications
基金
浙江省教育厅一般科研项目(Y202250677)
校青年培育项目(2020QNPY004)。
关键词
线程池
动态调节
实时监控
配置中心
并行计算
thread pool
dynamic adjustment
real-time monitoring
configuration center
parallel computing