You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hippo4j/docs/versioned_docs/version-1.4.2/user_docs/intro.md

619 lines
23 KiB

---
sidebar_position: 1
---
# 简介
## 线程池痛点
线程池是一种基于池化思想管理线程的工具,使用线程池可以减少创建销毁线程的开销,避免线程过多导致系统资源耗尽。
在高并发以及大批量的任务处理场景,线程池的使用是必不可少的。
如果有在项目中实际使用线程池,相信你可能会遇到以下痛点:
- 线程池随便定义,线程资源过多,造成服务器高负载。
- 线程池参数不易评估,随着业务的并发提升,业务面临出现故障的风险。
- 线程池任务执行时间超过平均执行周期,开发人员无法感知。
- 线程池任务堆积,触发拒绝策略,影响既有业务正常运行。
- 当业务出现超时、熔断等问题时,因为没有监控,无法确定是不是线程池引起。
- 原生线程池不支持运行时变量的传递,比如 MDC 上下文遇到线程池就 GG。
- 无法执行优雅关闭,当项目关闭时,大量正在运行的线程池任务被丢弃。
- 线程池运行中,任务执行停止,怀疑发生死锁或执行耗时操作,但是无从下手。
## 什么是 Hippo-4J
Hippo-4J 通过对 JDK 线程池增强,以及扩展三方框架底层线程池等功能,为业务系统提高线上运行保障能力。
提供以下功能支持:
- 全局管控 - 管理应用线程池实例。
- 动态变更 - 应用运行时动态变更线程池参数,包括不限于:核心、最大线程数、阻塞队列容量、拒绝策略等。
- 通知报警 - 内置四种报警通知策略,线程池活跃度、容量水位、拒绝策略以及任务执行时间超长。
- 运行监控 - 实时查看线程池运行时数据,最近半小时线程池运行数据图表展示。
- 功能扩展 - 支持线程池任务传递上下文;项目关闭时,支持等待线程池在指定时间内完成任务。
- 多种模式 - 内置两种使用模式:[依赖配置中心](https://hippo4j.cn/docs/user_docs/getting_started/config/hippo4j-config-start) 和 [无中间件依赖](https://hippo4j.cn/docs/user_docs/getting_started/server/hippo4j-server-start)。
- 容器管理 - Tomcat、Jetty、Undertow 容器线程池运行时查看和线程数变更。
- 框架适配 - Dubbo、Hystrix、RabbitMQ、RocketMQ 等消费线程池运行时数据查看和线程数变更。
## 快速开始
对于本地演示目的,请参阅 [Quick start](https://hippo4j.cn/docs/user_docs/user_guide/quick-start)
演示环境: [http://console.hippo4j.cn/index.html](http://console.hippo4j.cn/index.html)
## 接入登记
更多接入的公司,欢迎在 [登记地址](https://github.com/opengoofy/hippo4j/issues/13) 登记,登记仅仅为了产品推广。
## 联系我
![](https://user-images.githubusercontent.com/77398366/185774220-c11951f9-e130-4d60-8204-afb5c51d4401.png)
扫码添加微信备注hippo4j邀您加入群聊。若图片加载不出来访问 [官网站点](https://hippo4j.cn/docs/user_docs/other/group)。
## 友情链接
- [[ Sa-Token ]](https://github.com/dromara/sa-token):一个轻量级 java 权限认证框架,让鉴权变得简单、优雅!
- [[ HertzBeat ]](https://github.com/dromara/hertzbeat):易用友好的云监控系统, 无需 Agent, 强大自定义监控能力。
- [[ JavaGuide ]](https://github.com/Snailclimb/JavaGuide):一份涵盖大部分 Java 程序员所需要掌握的核心知识。
- [[ toBeBetterJavaer ]](https://github.com/itwanger/toBeBetterJavaer):一份通俗易懂、风趣幽默的 Java 学习指南。
## 贡献者
感谢所有为项目作出贡献的开发者。如果有意贡献,参考 [good first issue](https://github.com/opengoofy/hippo4j/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)。
<table>
<tr>
<td align="center">
<a href="https://github.com/itmachen">
<img src="https://avatars.githubusercontent.com/u/77398366?v=4" width="50;" alt="itmachen"/>
<br />
<sub><b>小马哥</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/shining-stars-lk">
<img src="https://avatars.githubusercontent.com/u/40255310?v=4" width="50;" alt="shining-stars-lk"/>
<br />
<sub><b>Lucky 8</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/weihubeats">
<img src="https://avatars.githubusercontent.com/u/42484192?v=4" width="50;" alt="weihubeats"/>
<br />
<sub><b>Weihubeats</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/pirme">
<img src="https://avatars.githubusercontent.com/u/41976977?v=4" width="50;" alt="pirme"/>
<br />
<sub><b>李金来</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/shanjianq">
<img src="https://avatars.githubusercontent.com/u/49084314?v=4" width="50;" alt="shanjianq"/>
<br />
<sub><b>Shanjianq</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hippo4jbot">
<img src="https://avatars.githubusercontent.com/u/93201205?v=4" width="50;" alt="hippo4jbot"/>
<br />
<sub><b>Hippo4jbot[bot]</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/iwangjie">
<img src="https://avatars.githubusercontent.com/u/23075587?v=4" width="50;" alt="iwangjie"/>
<br />
<sub><b>王杰</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/BigXin0109">
<img src="https://avatars.githubusercontent.com/u/24769514?v=4" width="50;" alt="BigXin0109"/>
<br />
<sub><b>BigXin0109</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/pizihao">
<img src="https://avatars.githubusercontent.com/u/48643103?v=4" width="50;" alt="pizihao"/>
<br />
<sub><b>Pizihao</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Gdk666">
<img src="https://avatars.githubusercontent.com/u/22442067?v=4" width="50;" alt="Gdk666"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/xqxyxchy">
<img src="https://avatars.githubusercontent.com/u/21134578?v=4" width="50;" alt="xqxyxchy"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/road2master">
<img src="https://avatars.githubusercontent.com/u/53806703?v=4" width="50;" alt="road2master"/>
<br />
<sub><b>Lijx</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/maxisvest">
<img src="https://avatars.githubusercontent.com/u/20422618?v=4" width="50;" alt="maxisvest"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/baymax55">
<img src="https://avatars.githubusercontent.com/u/35788491?v=4" width="50;" alt="baymax55"/>
<br />
<sub><b>Baymax55</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/zhuanghaozhe">
<img src="https://avatars.githubusercontent.com/u/73152769?v=4" width="50;" alt="zhuanghaozhe"/>
<br />
<sub><b>庄昊哲</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/liulinfei121">
<img src="https://avatars.githubusercontent.com/u/57127515?v=4" width="50;" alt="liulinfei121"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Atmanuclear">
<img src="https://avatars.githubusercontent.com/u/25747005?v=4" width="50;" alt="Atmanuclear"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hippo4j">
<img src="https://avatars.githubusercontent.com/u/93200041?v=4" width="50;" alt="hippo4j"/>
<br />
<sub><b>Hippo4j</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/imyzt">
<img src="https://avatars.githubusercontent.com/u/28680198?v=4" width="50;" alt="imyzt"/>
<br />
<sub><b>杨镇涛</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Tliutao">
<img src="https://avatars.githubusercontent.com/u/17719583?v=4" width="50;" alt="Tliutao"/>
<br />
<sub><b>Liutao</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/monsterxxp">
<img src="https://avatars.githubusercontent.com/u/37952446?v=4" width="50;" alt="monsterxxp"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/voilaf">
<img src="https://avatars.githubusercontent.com/u/16870828?v=4" width="50;" alt="voilaf"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/wulangcode">
<img src="https://avatars.githubusercontent.com/u/48200100?v=4" width="50;" alt="wulangcode"/>
<br />
<sub><b>WuLang</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/gywanghai">
<img src="https://avatars.githubusercontent.com/u/102774648?v=4" width="50;" alt="gywanghai"/>
<br />
<sub><b>二师兄</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/skyemin">
<img src="https://avatars.githubusercontent.com/u/38172444?v=4" width="50;" alt="skyemin"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Redick01">
<img src="https://avatars.githubusercontent.com/u/15903214?v=4" width="50;" alt="Redick01"/>
<br />
<sub><b>Redick Liu</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/xiaochengxuyuan">
<img src="https://avatars.githubusercontent.com/u/9032006?v=4" width="50;" alt="xiaochengxuyuan"/>
<br />
<sub><b>Sean Wu</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/HKMV">
<img src="https://avatars.githubusercontent.com/u/26456469?v=4" width="50;" alt="HKMV"/>
<br />
<sub><b>Serenity</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/gewuwo">
<img src="https://avatars.githubusercontent.com/u/97213587?v=4" width="50;" alt="gewuwo"/>
<br />
<sub><b>格悟沃</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hushtian">
<img src="https://avatars.githubusercontent.com/u/55479601?v=4" width="50;" alt="hushtian"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jinlingmei">
<img src="https://avatars.githubusercontent.com/u/24669082?v=4" width="50;" alt="jinlingmei"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/linlinjie">
<img src="https://avatars.githubusercontent.com/u/22275940?v=4" width="50;" alt="linlinjie"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/selectbook">
<img src="https://avatars.githubusercontent.com/u/8454350?v=4" width="50;" alt="selectbook"/>
<br />
<sub><b>Leping Huang</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/soulmz">
<img src="https://avatars.githubusercontent.com/u/10662992?v=4" width="50;" alt="soulmz"/>
<br />
<sub><b>Soulzz</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/tomsun28">
<img src="https://avatars.githubusercontent.com/u/24788200?v=4" width="50;" alt="tomsun28"/>
<br />
<sub><b>Tomsun28</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/backbay2-yzg">
<img src="https://avatars.githubusercontent.com/u/64394486?v=4" width="50;" alt="backbay2-yzg"/>
<br />
<sub><b>游祖光</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/puppet4">
<img src="https://avatars.githubusercontent.com/u/28887178?v=4" width="50;" alt="puppet4"/>
<br />
<sub><b>Tudo</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yanrongzhen">
<img src="https://avatars.githubusercontent.com/u/106363931?v=4" width="50;" alt="yanrongzhen"/>
<br />
<sub><b>严荣振</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/2EXP">
<img src="https://avatars.githubusercontent.com/u/26007713?v=4" width="50;" alt="2EXP"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/onesimplecoder">
<img src="https://avatars.githubusercontent.com/u/30288465?v=4" width="50;" alt="onesimplecoder"/>
<br />
<sub><b>Alic</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/CalebZYC">
<img src="https://avatars.githubusercontent.com/u/42887532?v=4" width="50;" alt="CalebZYC"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Hibernate5666">
<img src="https://avatars.githubusercontent.com/u/30147527?v=4" width="50;" alt="Hibernate5666"/>
<br />
<sub><b>Cheng Xihong</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/smartdj">
<img src="https://avatars.githubusercontent.com/u/3272679?v=4" width="50;" alt="smartdj"/>
<br />
<sub><b>DJ</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dmego">
<img src="https://avatars.githubusercontent.com/u/22118976?v=4" width="50;" alt="dmego"/>
<br />
<sub><b>Dmego</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dousp">
<img src="https://avatars.githubusercontent.com/u/5936499?v=4" width="50;" alt="dousp"/>
<br />
<sub><b>Douspeng</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/hl1248">
<img src="https://avatars.githubusercontent.com/u/70790953?v=4" width="50;" alt="hl1248"/>
<br />
<sub><b>Lucas</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/gentlelynn">
<img src="https://avatars.githubusercontent.com/u/19168453?v=4" width="50;" alt="gentlelynn"/>
<br />
<sub><b>Lynn</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/alexhaoxuan">
<img src="https://avatars.githubusercontent.com/u/46749051?v=4" width="50;" alt="alexhaoxuan"/>
<br />
<sub><b>Alexli</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/qizhongju">
<img src="https://avatars.githubusercontent.com/u/19883548?v=4" width="50;" alt="qizhongju"/>
<br />
<sub><b>Bug搬运工</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/san4j">
<img src="https://avatars.githubusercontent.com/u/40364355?v=4" width="50;" alt="san4j"/>
<br />
<sub><b>San4j</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/zhenyed">
<img src="https://avatars.githubusercontent.com/u/26167590?v=4" width="50;" alt="zhenyed"/>
<br />
<sub><b>Zhenye</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dongming0920">
<img src="https://avatars.githubusercontent.com/u/57832778?v=4" width="50;" alt="dongming0920"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/f497196689">
<img src="https://avatars.githubusercontent.com/u/15325854?v=4" width="50;" alt="f497196689"/>
<br />
<sub><b>Fengjing</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Snailclimb">
<img src="https://avatars.githubusercontent.com/u/29880145?v=4" width="50;" alt="Snailclimb"/>
<br />
<sub><b>Guide</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/hbw1994">
<img src="https://avatars.githubusercontent.com/u/22744421?v=4" width="50;" alt="hbw1994"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hncboy">
<img src="https://avatars.githubusercontent.com/u/27755574?v=4" width="50;" alt="hncboy"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/stronglong">
<img src="https://avatars.githubusercontent.com/u/15846157?v=4" width="50;" alt="stronglong"/>
<br />
<sub><b>Itermis</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/janey668">
<img src="https://avatars.githubusercontent.com/u/99872936?v=4" width="50;" alt="janey668"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/klsq94">
<img src="https://avatars.githubusercontent.com/u/16208392?v=4" width="50;" alt="klsq94"/>
<br />
<sub><b>Hui Cao</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kongyanbo-cx">
<img src="https://avatars.githubusercontent.com/u/58963923?v=4" width="50;" alt="kongyanbo-cx"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/lishiyu">
<img src="https://avatars.githubusercontent.com/u/36871640?v=4" width="50;" alt="lishiyu"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Nhxz">
<img src="https://avatars.githubusercontent.com/u/72447160?v=4" width="50;" alt="Nhxz"/>
<br />
<sub><b>Nhxz</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/op-lht">
<img src="https://avatars.githubusercontent.com/u/34021816?v=4" width="50;" alt="op-lht"/>
<br />
<sub><b>Op-lht</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/wangjie-github">
<img src="https://avatars.githubusercontent.com/u/35762878?v=4" width="50;" alt="wangjie-github"/>
<br />
<sub><b>Wangjie</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/wangyi123456">
<img src="https://avatars.githubusercontent.com/u/25248959?v=4" width="50;" alt="wangyi123456"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Williamren97">
<img src="https://avatars.githubusercontent.com/u/43086401?v=4" width="50;" alt="Williamren97"/>
<br />
<sub><b>William Ren</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/wzw8795">
<img src="https://avatars.githubusercontent.com/u/90670917?v=4" width="50;" alt="wzw8795"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/huaxianchao">
<img src="https://avatars.githubusercontent.com/u/50727527?v=4" width="50;" alt="huaxianchao"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yangzhiw">
<img src="https://avatars.githubusercontent.com/u/13634974?v=4" width="50;" alt="yangzhiw"/>
<br />
<sub><b>Opentanent</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/yhc777">
<img src="https://avatars.githubusercontent.com/u/71164753?v=4" width="50;" alt="yhc777"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/zhaiweij">
<img src="https://avatars.githubusercontent.com/u/10173248?v=4" width="50;" alt="zhaiweij"/>
<br />
<sub><b>Zhaiweij</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/zhaojinchao95">
<img src="https://avatars.githubusercontent.com/u/33742097?v=4" width="50;" alt="zhaojinchao95"/>
<br />
<sub><b>Zhaojinchao</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/zj1997">
<img src="https://avatars.githubusercontent.com/u/31212787?v=4" width="50;" alt="zj1997"/>
<br />
<sub><b>Null</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/li-xiao-shuang">
<img src="https://avatars.githubusercontent.com/u/34903552?v=4" width="50;" alt="li-xiao-shuang"/>
<br />
<sub><b>李晓双 Li Xiao Shuang</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/oreoft">
<img src="https://avatars.githubusercontent.com/u/51789848?v=4" width="50;" alt="oreoft"/>
<br />
<sub><b>没有气的汽水</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/wo883721">
<img src="https://avatars.githubusercontent.com/u/10241323?v=4" width="50;" alt="wo883721"/>
<br />
<sub><b>Xinhao</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Createsequence">
<img src="https://avatars.githubusercontent.com/u/49221670?v=4" width="50;" alt="Createsequence"/>
<br />
<sub><b>黄成兴</b></sub>
</a>
</td></tr>
</table>