--
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina
The primary limit is the memory for the goroutines. Each goroutine starts with a 4kB stack and a little more per-goroutine data, so the overhead is between 4kB and 5kB. That means on this laptop I can easily run 100,000 goroutines, in 500 MB of memory, but a million goroutines is probably too much.
For a lot of simple goroutines, the 4 kB stack is probably more than
necessary. If we worked on getting that down we might be able to
handle even more goroutines. But remember that this is in contrast to
C threads, where 64 kB is a tiny stack and 1-4MB is more common.
--
rsc在 http://research.swtch.com/gotour 的Q&A里有提到(当然看Go的源码更好啦,呵呵)
具体看这两个问题:
Q. What are the limits to scalability with building a system with many goroutines?
The primary limit is the memory for the goroutines. Each goroutine starts with a 4kB stack and a little more per-goroutine data, so the overhead is between 4kB and 5kB. That means on this