# 重新思考 Go：Channel 不是「消息队列」

DevFeed: [重新思考 Go：Channel 不是「消息队列」](<https://devfeed.tech/articles/go-channel-40987.md>)

Original publisher: [Read original article](<https://blog.joway.io/posts/golang-rethink-channel/>)

Author: Joway

Published: 2024-03-31T00:00:00Z

Content type: opinion

Language: zh

Sources: [Random Thoughts](<https://devfeed.tech/sources/random-thoughts.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Processes](<https://devfeed.tech/topics/processes.md>)

Tags: [cpu](<https://devfeed.tech/tags/cpu.md>), [csp](<https://devfeed.tech/tags/csp.md>), [go](<https://devfeed.tech/tags/go.md>), [input](<https://devfeed.tech/tags/input.md>), [make](<https://devfeed.tech/tags/make.md>), [process](<https://devfeed.tech/tags/process.md>), [queue](<https://devfeed.tech/tags/queue.md>), [tech](<https://devfeed.tech/tags/tech.md>)

## AI overview

This article argues that Go channels are designed primarily for communication and blocking coordination between goroutines, not as robust in-process message queues. It examines blocking when channels are full, uncontrolled consumer throughput, and the resulting pressure on core processing paths. The author concludes that using channels as queues can be a questionable technology choice and suggests a more complete standard-library queue implementation.

## Source excerpt

重新思考 Go 系列：这个系列希望结合工作中在 Go 编程与性能优化中遇到过的问题，探讨 Go 在语言哲学、底层实现和现实需求三者之间关系与矛盾。 Go 语言是一门为实现 CSP 并发模型而设计的语言，这也是它区别于其他语言最大的特色。而为了实现这一点，Go 在语法上就内置了 chan 的数据结构来作为不同协程间通信的载体。