New issue
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
Consumer实现中关于线程池的疑问 #34
Comments
consumer使用pull的方式去拉取数据 还有getExecutor()部分应该每次都返回是同一个threadpool实例,不需要每次new一个,没看到你贴这部分代码,不是太清楚你如何实现的。 |
线程池并不能提高单个消息的处理速度,原来是什么速度,现在还是什么速度,你想想是不是这样。 线程池的意义在于可以不阻塞消息接受的线程,提高消息处理的吞吐量。 |
嗯。非常谢谢两位的回复。 |
@rottle 你的机器如果是4核,8核的,那跟你创建一个线程池跑不会有太大区别。也取决于你的任务类型,如果是CPU密集型,更多线程也不会带来提升,甚至可能下降。 在 2013年3月21日下午3:56,rottle notifications@github.com写道:
庄晓丹 |
Consumer实现中,用到的MessageListener,其中,public Executor getExecutor(),返回处理消息的线程池。比如,我采用Executors.newFixedThreadPool(8)返回一个简单的线程池。可是通过计算消息的平均处理时间,发现性能并没有提高多少?这个地方,是否我理解有误?不能这样实现?
The text was updated successfully, but these errors were encountered: