-
在go GMP模型中,数据结构G本身会被go scheduler复用,从内存和性能方面考虑,是不是和goroutine pool中对goroutine的复用效果是一样的呢 |
Beta Was this translation helpful? Give feedback.
Answered by
panjf2000
May 18, 2022
Replies: 1 comment 2 replies
-
不只是复用,goroutine pool 还有一个主要的特性是限制,go原生的复用不会做数量的限制。还有就是 pool 其实是 worker 模式,相当于提前起动了一批 goroutines 在跑,不用每次都重新创建。 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hugh-404
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
不只是复用,goroutine pool 还有一个主要的特性是限制,go原生的复用不会做数量的限制。还有就是 pool 其实是 worker 模式,相当于提前起动了一批 goroutines 在跑,不用每次都重新创建。