知识卡片
队列切分表达隔离
独立队列可给不同工作分配线程预算,缓和长计算对请求处理的影响。它只规定资源分区,执行顺序和兜底取决于调度规则。先决定哪些任务允许借线程,再设置容量与负载观察。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Chapter 3. Building Our Own Async Queues 为不同负载配置队列 · 查看原书依据
One of the reasons we would want to have multiple queues is that we might have different priorities for tasks. In this section, we are going to build a high-priority queue with two consuming threads and a low-priority queue with one consuming thread. To support multiple queues, we need the following enum to classify the type of queue the task is destined for:
参考来源
- 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第03章《Chapter 3. Building Our Own Async Queues》,为不同负载配置队列(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch03.html#id18)
- 结论依据:高低队列各有指定 worker 与回调,负载失衡时部分线程长时间空闲。
- 原始内容:One of the reasons we would want to have multiple queues is that we might have different priorities for tasks. In this section, we are going to build a high-priority queue with two consuming threads and a low-priority queue with one consuming thread. To support multiple queues, we need the following enum to classify the type of queue the task is destined for: