Comments (4)
consumer使用pull的方式去拉取数据
你拉取到数据后,扔给threadpool去处理
全部扔入threadpool后,consumer进行下一次拉取数据操作
看你的描述,没办法搞清楚,你具体每条信息消费的耗时,所以没办法衡量扔入threadpool是否会比直接处理消息,吞吐更快一些。
还有getExecutor()部分应该每次都返回是同一个threadpool实例,不需要每次new一个,没看到你贴这部分代码,不是太清楚你如何实现的。
from metamorphosis.
线程池并不能提高单个消息的处理速度,原来是什么速度,现在还是什么速度,你想想是不是这样。
线程池的意义在于可以不阻塞消息接受的线程,提高消息处理的吞吐量。
from metamorphosis.
嗯。非常谢谢两位的回复。
可能我的描述不太清楚。举个例子吧。比如一次拉取6000条消息,getExecutor(){return null}是采用单线程处理,共耗时300秒,即每条消息耗时50ms;同样,一次拉取6000条消息,如果通过getExecutor(){ return pool},即返回一个线程池(固定大小8),共耗时应该小于300S,可能为200S。基于上述,消息吞吐量应该是提高了。@killme2008 的回复,我清楚意思。
我的问题是:我经过测试发现,上述情况,6000条的处理时间,在线程池中基本还是300S,按道理总耗时应该更少的???????
from metamorphosis.
@rottle
return
null不是单线程处理,默认是CPU个数的线程做消息拉取,你在拉取线程跑,那就是至少cpu个线程在处理消息。这个可以通过ConsumerConfig.fetchRunnerCount设置。也就是拉取本身就是多线程的。
你的机器如果是4核,8核的,那跟你创建一个线程池跑不会有太大区别。也取决于你的任务类型,如果是CPU密集型,更多线程也不会带来提升,甚至可能下降。
在 2013年3月21日下午3:56,rottle [email protected]写道:
嗯。非常谢谢两位的回复。
可能我的描述不太清楚。举个例子吧。比如一次拉取6000条消息,getExecutor(){return
null}是采用单线程处理,共耗时300秒,即每条消息耗时50ms;同样,一次拉取6000条消息,如果通过getExecutor(){ return
pool},即返回一个线程池(固定大小8),共耗时应该小于300S,可能为200S。基于上述,消息吞吐量应该是提高了。@killme2008https://github.com/killme2008的回复,我清楚意思。
我的问题是:我经过测试发现,上述情况,6000条的处理时间,在线程池中基本还是300S,按道理总耗时应该更少的???????—
Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-15223631
.
庄晓丹
Email: [email protected] [email protected]
Site: http://fnil.net
Twitter: @killme2008
from metamorphosis.
Related Issues (20)
- 如何发送定时消息 HOT 1
- Query pending messages shows negative consumed messages
- 不停的创建新线程直至资源耗尽 HOT 5
- 关于consumer 安全消费的问题 HOT 1
- Spring配置共享订阅者方式中的问题
- Send message timeout时不能自动恢复的问题
- Metamorphosis 分布式事务支持 HOT 1
- Consumer消费失败问题
- Offset存储异常问题
- Offset存储Mysql异常问题
- 与Storm0.10集成出错
- zk每个两三天就会过期重连 HOT 2
- 发送消息的主题不能自定义吗? HOT 7
- MetaQ接收数据客户端进入死循环 HOT 2
- 这么通用的中间件,原码为何不用utf-8,而用GBK?造成编译很容易出问题。 HOT 3
- 是否支持一条消息多个消费点 同时消费
- 如何发送延时消息 HOT 1
- 图挂了 HOT 1
- Inconsistent library versions notice.
- 关于MessageConsumer shutdown的问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metamorphosis.