知识卡片

普通读书笔记卡 · 4545.g.3.c.2

分流分摊工作并保留背压

理解等级:中级

Fan-Out把一个输入流的任务分给多个工作者,每条任务被分配给其中一个,而不是广播给全部。轮询转发较简单,却可能被当前慢工作者卡住;多个转发者竞争读取可减少这一瓶颈,但不保证严格均分或顺序。输入结束、输出关闭与工作者等待应共同安排。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Cloud Native Patterns · 查看原书依据

      Using a single goroutine that reads values from Source and forwards them to the Destinations in a round-robin fashion. This has the virtue of requiring only one master goroutine, but if the next channel isn’t ready to read yet it’ll slow the entire process. Using separate goroutines for each Destination that compete to read the

    参考来源

    - 位置:《Cloud Native Go》第04章《Cloud Native Patterns》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch04.xhtml) - 结论依据:Fan-Out把一个输入流的任务分给多个工作者,每条任务被分配给其中一个,而不是广播给全部。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:Using a single goroutine that reads values from Source and forwards them to the Destinations in a round-robin fashion. This has the virtue of requiring only one master goroutine, but if the next channel isn’t ready to read yet it’ll slow the entire process. Using separate goroutines for each Destination that compete to read the