-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
优先级队列支持 #59
Comments
/cc @panjf2000 |
我猜你想说的是在 worker struct 里加优先的队列吧?worker 每次先尝试从优先 channel 里取任务执行? |
你说的这些都是实现问题了。从功能上来说,就是希望当池子被用满的时候,高优先级队列可以被确保插队来执行。现在我理解是不能的吧。现在如果池子已经满了,有一些请求阻塞在 Submit 这里,怎么保证高优任务优先执行呢 |
多个 pool 就有很多管理难度,我就需要监控多个 pool,参数里也要调整多个 pool 的大小,而且高优队列可能处于长期闲置状态,在平时浪费资源。 |
|
|
priority queue 太简单了,很容易就饿死了。 |
这么复杂的场景直接用消息队列不香吗? |
@tmpbook 这跟消息队列没啥关系 |
priority queue 实现是完全可以接受的,调度算法本质上都大同小异,自己做降级不就ok了 |
This issue is marked as stale because it has been open for 30 days with no activity. You should take one of the following actions:
This issue will be automatically closed in 7 days if no further activity occurs. |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
优先级调度。比如除了 Submit 之外,提供 SubmitUrge 接口之类的,提供多优先级调度功能
Describe the solution you'd like
A clear and concise description of what you want to happen.
最简单的办法,可以做三个队列,最高的是 urgent,最低的是 delayed,中间的就是现在的队列。调度策略可以开成 interface 方便定制,简单的策略可以类似于内核 io 调度的 deadline 调度器。
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
只能做多个 pool,但是也不好实现多个 pool 之间的优先级调度。
Additional context
Add any other context or screenshots about the feature request here.
确实有高优先级调度的需求
The text was updated successfully, but these errors were encountered: