当前位置:网站首页>Thrift threadmanager and three monitors
Thrift threadmanager and three monitors
2022-07-03 13:49:00 【yolo_ yyh】
Catalog
One 、ThreadManager
effect : Thread pool management class , Create a thread with a thread factory
characteristic : Threads will not be created or destroyed , Instead, save the number of idle threads variable 、 Active threads variable ;
Maintain a task (task) queue , And balance the response and waiting time of the service , Notify the thread pool policy object (PoolPolicy object ) Relevant information , from PoolPolicy object Determine pool sizing , The advantage of this is that the strategy can be decoupled .
Two 、 Three Monitor
(1) monitor_
To coordinate task Fast execution , Join the slow situation , When one worker Finish one task, It will start from tasks Get another one in , If not , Just block ; When new task Add to tasks perhaps worker When cleaned ,monitor_ Wake up again .
(2) workerMonitor_
Every worker Run out task Will be added to deadWorkers_ Inside ,addWorker and removeWorker Will not change workCount_, It will only change workMaxCount_, Only when run When it's time to change manager_ Of workerCount_, Synchronization is by workerMonitor_ be responsible for .
(3) maxMonitor_
Used to monitor waiting task number , When manager_ call add add to task when , If the maximum has been exceeded , Will wait , Wait until call worker Of run Method , Remove... From the task queue task after , When the task queue length is less than the maximum , Wake up again .
边栏推荐
- The shortage of graphics cards finally came to an end: 3070ti for more than 4000 yuan, 2000 yuan cheaper than the original price, and 3090ti
- Go language web development series 29: Gin framework uses gin contrib / sessions library to manage sessions (based on cookies)
- Unity EmbeddedBrowser浏览器插件事件通讯
- The solution of Chinese font garbled code in keil5
- 服务器硬盘冷迁移后网卡无法启动问题
- Red hat satellite 6: better management of servers and clouds
- logback日志的整理
- Flutter dynamic | fair 2.5.0 new version features
- 【电脑插入U盘或者内存卡显示无法格式化FAT32如何解决】
- Depth and breadth first traversal of tree (regardless of binary tree)
猜你喜欢

MySQL installation, uninstallation, initial password setting and general commands of Linux

The latest BSC can pay dividends. Any B usdt Shib eth dividend destruction marketing can

Golang - command line tool Cobra

SQL Injection (GET/Search)

3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)

Go language unit test 4: go language uses gomonkey to test functions or methods

CVPR 2022 | 美团技术团队精选6篇优秀论文解读

MySQL 数据增删改查综合案例

物联网毕设 --(STM32f407连接云平台检测数据)

Box layout of Kivy tutorial BoxLayout arranges sub items in vertical or horizontal boxes (tutorial includes source code)
随机推荐
Kivy tutorial how to load kV file design interface by string (tutorial includes source code)
MySQL 数据增删改查综合案例
ThreadPoolExecutor realizes multi-threaded concurrency and obtains the return value (elegant and concise way)
mysql中的字段问题
Screenshot of the operation steps of upload labs level 4-level 9
[quantitative trading] permanent portfolio, turtle trading rules reading, back testing and discussion
SQL Injection (AJAX/JSON/jQuery)
Spark实战1:单节点本地模式搭建Spark运行环境
Go language unit test 3: go language uses gocovey library to do unit test
[redis] cache warm-up, cache avalanche and cache breakdown
实现CNN图像的识别和训练通过tensorflow框架对cifar10数据集等方法的处理
Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
Unity embeddedbrowser browser plug-in event communication
[556. Next larger element III]
Libuv库 - 设计概述(中文版)
SQL Injection (POST/Select)
Complete deep neural network CNN training with tensorflow to complete picture recognition case 2
Several common optimization methods matlab principle and depth analysis
Setting up remote links to MySQL on Linux
[how to earn a million passive income]