当前位置:网站首页>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 .
边栏推荐
- Asp. Net core1.1 without project JSON, so as to generate cross platform packages
- 【BW16 应用篇】安信可BW16模组与开发板更新固件烧录说明
- Screenshot of the operation steps of upload labs level 4-level 9
- MySQL 数据增删改查综合案例
- The network card fails to start after the cold migration of the server hard disk
- MySQL functions and related cases and exercises
- Go language unit test 4: go language uses gomonkey to test functions or methods
- Go language web development series 27: Gin framework: using gin swagger to implement interface documents
- logback日志的整理
- Realize the recognition and training of CNN images, and process the cifar10 data set and other methods through the tensorflow framework
猜你喜欢
Kivy教程之 盒子布局 BoxLayout将子项排列在垂直或水平框中(教程含源码)
This math book, which has been written by senior ml researchers for 7 years, is available in free electronic version
CVPR 2022 | 美团技术团队精选6篇优秀论文解读
SQL Injection (GET/Search)
Unable to stop it, domestic chips have made another breakthrough, and some links have reached 4nm
The principle of human voice transformer
全面发展数字经济主航道 和数集团积极推动UTONMOS数藏市场
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
MySQL functions and related cases and exercises
Mycms we media mall v3.4.1 release, user manual update
随机推荐
软件测试工作那么难找,只有外包offer,我该去么?
Can newly graduated European college students get an offer from a major Internet company in the United States?
This math book, which has been written by senior ml researchers for 7 years, is available in free electronic version
项目协作的进度如何推进| 社区征文
如何使用lxml判断网站公告是否更新
Go language web development series 30: gin: grouping by version for routing
Swiftui development experience: the five most powerful principles that a programmer needs to master
Asp.Net Core1.1版本没了project.json,这样来生成跨平台包
Mastering the cypress command line options is the basis for truly mastering cypress
IBEM mathematical formula detection data set
Unity EmbeddedBrowser浏览器插件事件通讯
Go 1.16.4: purpose of go mod tidy
Realize the recognition and training of CNN images, and process the cifar10 data set and other methods through the tensorflow framework
Mobile phones and computers can be used, whole people, spoof code connections, "won't you Baidu for a while" teach you to use Baidu
[technology development-24]: characteristics of existing IOT communication technology
Spark实战1:单节点本地模式搭建Spark运行环境
SVN添加文件时的错误处理:…\conf\svnserve.conf:12: Option expected
Depth and breadth first traversal of tree (regardless of binary tree)
Golang — 命令行工具cobra
Resource Cost Optimization Practice of R & D team