Comments (7)
from webman-rqueue.
应该是这个原因,我把$timerInterval消费间隔改成1秒占用就下来了
from webman-rqueue.
- 队列的消费利用的是event-loop的timer
- 延迟队列是利用消息的delay的判断+消息的republish来模拟的
所以延迟队列在消费间隔较小的时候会频繁对延迟队列的消息进行滚动,反复read+republish,直到delay条件达到;在这个情况下,CPU会占用较高,一方面是redis本身压力会增加,一方面是队列在接近空转的情况下处理;
所以:
- 延迟队列尽可能消费间隔大一些
- 不同的延迟任务尽可能分散在不同消费间隔的延迟队列【可选项建议】
from webman-rqueue.
通过对以下三个参数的调整可以在消费能力、消费时效性、CPU占用率上达到平衡
- QOS,单个进程单次读取的最大消息树
- timerInterval, 单个进程消费间隔时间
- count,消费组最大消费者数量
from webman-rqueue.
计划在下一个版本增加自适应定时间隔:
- 增加闲置间隔idle_limit配置参数,接受一个int,单位ms
- 增加退避指数avoid_index配置,接受一个float
- 增加最大退避间隔avoid_interval配置,接受一个float,单位ms
- 优化当前定时消费为自适应定时消费
当idle_limit时间内没有读取到任何消息时,当前消费进程的定时器会根据退避指数avoid_index倍数增加自己的定时器间隔,每增加一次间隔后的下一次如果依然没有读取到消息,则定时器间隔呈avoid_index指数倍数上升;
定时器间隔不会超过最大退避间隔;
当任意一次消息被读取后,定时器间隔恢复初始化。
from webman-rqueue.
感谢作者的答疑。自适应的这种效果确实不错,现在默认的1ms间隔确实太短了,如果不修改的话,一般云服务器大部分都是低主频确实容易高占用。
from webman-rqueue.
2.1.10版本开始增加了自适应队列,是一个实验性质的功能特性,待成熟后,会在2.2中正式加入
from webman-rqueue.
Related Issues (10)
- 非延迟队列设置timerInterval 显示busy HOT 6
- 可用于生产环境吗? HOT 1
- 支持php8.0+吗? HOT 1
- 为rqueue增加psr/log及日志收集部分
- 完善webman-rqueue的消费者测试
- 增加对pending状态数据的处理
- republish的优化 HOT 1
- 释放消息bug
- 建议延迟队列增加一个重新发送覆盖前一个任务的功能 HOT 22
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webman-rqueue.