Concurrency Patterns in CArtsiom Bukhautsou Senior Backend Engineer @Nord SecurityFan-out 🌱 Pipeline 🤔 Fan-in, Fan-out, Pipeline 🦾 Agenda Fan-in 🌱 Tee 🌱 1. 2. 3. 4. 5.Why learn these patterns?Fan-inFan-in Pros - Simplifies Stage latency accumulation Use cases - ETL processes - Multimedia processingPipeline (Example)Fan-in, Fan-out, PipelineFan-in, Fan-out, Pipeline Pros - Maximized throughput - Scalable architecture0 码力 | 20 页 | 1.35 MB | 6 月前3
Go Context原理及其典型适用场景大纲 Channel Fan-in func fanIn(sum1, sum2 <-chan int) <-chan int { sum := make(chan int) go func() { for {sum <- <-sum1} }() go func() { for {sum <- <-sum2} }() return sum } Fan-in Chan Chan Chan Fan-in func main() { sum := fanIn(add(1, 2), add(4, 9)) fmt.Println(<-sum) fmt.Println(<-sum) } Select func fanIn(sum1, sum2 <-chan int) <-chan int { sum := make(chan int) go func() { for0 码力 | 32 页 | 4.62 MB | 1 年前3
Go 2 Generics? A (P)review试试写个 append()? 2020 © Changkun Ou · Go 夜读 · Go 2 Generics? A (P)review Example 5: Fan-in Fan-out 30 1 // generic fan-in -- by changkun 2 func Fanin(type T)(ins ...<-chan T) <-chan T { 3 buf := 00 码力 | 41 页 | 770.62 KB | 1 年前3
7 Years of Talking to People: The Importance of Giving Talks in Golang Warsaw #59Deadlines, Cancellation, and Timeouts" 7. "Advanced Channel Patterns in Go: Pipeline, Fan-Out, and Fan-In" 8. "Understanding Go's Package Structure and Module System" 9. "Effective Use of Reflection in0 码力 | 26 页 | 3.20 MB | 6 月前3
Go 101 (Golang 101) v1.21.0From the last example, we can find that, with the help of aggregators, it is easy to implement fan-in and fan-out for the number of workers for a specified module. In fact, we can use a simple channel0 码力 | 610 页 | 945.17 KB | 1 年前3
Go 101 (Golang 101) v1.21.0From the last example, we can find that, with the help of aggregators, it is easy to implement fan-in and fan-out for the number of workers for a specified module. In fact, we can use a simple channel0 码力 | 880 页 | 833.34 KB | 1 年前3
Go 101 (Golang 101) v1.21.0From the last example, we can find that, with the help of aggregators, it is easy to implement fan-in and fan-out for the number of workers for a specified module. In fact, we can use a simple channel0 码力 | 630 页 | 3.77 MB | 1 年前3
Golang 101(Go语言101 中文版) v1.21.a但是有环拓扑结构的数据流系统在实践中很少用。 从上面两个例子可以看出,使用通道来构建数据流系统是很简单和直观的。 从上例可以看出,通过使用数据聚合模块,我们可以很轻松地实现各个模块的 工作协程数量的扇入(fan-in)和扇出(fan-out)。 事实上,我们也可以使用一个简单的通道来代替数据聚合模块的角色。比如, 下面的代码使用两个通道代替了上例中的两个数据聚合器。 1| package main 2|0 码力 | 821 页 | 956.82 KB | 1 年前3
Golang 101(Go语言101 中文版) v1.21.a但是有环拓扑结构的数据流系统在实践中很少用。 从上面两个例子可以看出,使用通道来构建数据流系统是很简单和直观的。 从上例可以看出,通过使用数据聚合模块,我们可以很轻松地实现各个模块的 工作协程数量的扇入(fan-in)和扇出(fan-out)。 事实上,我们也可以使用一个简单的通道来代替数据聚合模块的角色。比如, 下面的代码使用两个通道代替了上例中的两个数据聚合器。 package main ... //0 码力 | 608 页 | 1.08 MB | 1 年前3
Golang 101(Go语言101 中文版) v1.21.a但是有环拓扑结构的数据流系统在实践中很少用。 从上面两个例子可以看出,使用通道来构建数据流系统是很简单和直观的。 从上例可以看出,通过使用数据聚合模块,我们可以很轻松地实现各个模块的工作 协程数量的扇入(fan-in)和扇出(fan-out)。 事实上,我们也可以使用一个简单的通道来代替数据聚合模块的角色。比如,下面 的代码使用两个通道代替了上例中的两个数据聚合器。 1| package main 2|0 码力 | 591 页 | 21.40 MB | 1 年前3
共 10 条
- 1













