We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
传统的reactor在收包时往往是异步的,它内部实现可能是线程池,或者系统底层信号处理,所以它的线程其实是复用的,也就是说一般不会产生特别多的线程,但是Tao中每个连接创建3个goroutine,而且都是阻塞的,一般服务器同时万数量级连接应该很正常,此时可能就需要3*connCount 量级的goroutine,没有研读过goroutine源码,但大致了解内部应该也是线程池处理,此时每个goroutine都是阻塞的,那么就是所有连接相关的goroutine都得不到回收,那么万数量级的线程切换给cpu带来的性能消耗肯定是低效的,不知道这块是设计上的失误还是我理解不透彻?
The text was updated successfully, but these errors were encountered:
这个是我对goroutine理解上的问题,goroutine的调度并不用走系统调用,所以线程和goroutine并没有直接对应关系,即使goroutine被阻塞也是go自己维护,没有上下文切换,所以goroutine很廉价,即使创建上万的goroutine也不会有性能上的问题
Sorry, something went wrong.
@lixiang-share 恩恩,goroutine是轻量级线程,在用户态实现,所以我们可以“奢侈”一点,reactor模型是对线程的复用,这就是Go语言带来的“好处”——我们可以按照同步的思维方式写代码,异步交给语言层面去负责
No branches or pull requests
传统的reactor在收包时往往是异步的,它内部实现可能是线程池,或者系统底层信号处理,所以它的线程其实是复用的,也就是说一般不会产生特别多的线程,但是Tao中每个连接创建3个goroutine,而且都是阻塞的,一般服务器同时万数量级连接应该很正常,此时可能就需要3*connCount 量级的goroutine,没有研读过goroutine源码,但大致了解内部应该也是线程池处理,此时每个goroutine都是阻塞的,那么就是所有连接相关的goroutine都得不到回收,那么万数量级的线程切换给cpu带来的性能消耗肯定是低效的,不知道这块是设计上的失误还是我理解不透彻?
The text was updated successfully, but these errors were encountered: