脚本宝典收集整理的这篇文章主要介绍了javascript代码实例教程-JStorm/Strom配置executors和tasks(线程和实例),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。
注意:JStorm马上融合到Strom内核了,这意味着以后没有Strom了。不过TwITter 对外宣讲了他们的Heron系统,
请始终记得标题:executors和tasks(线程和实例),executors代表线程概念,tasks代表spout或bolt实例。
Storm默认会为每个组成(spout/bolt)创建一个任务(task),默认一个任务运行被一个线程(executor)调用。
> setSpout(String id, IRichSpout spout,Number parallelism_hint)
上面的配置表示:拓扑要创建parallelism_hint个任务(tasks),每一个任务被所属于自己的线程(executor)调用。即任务数目和线程数目一样。
> setSpout(String id, IRichSpout spout,Number parallelism_hint).setNumtasks(Number val)
上面的配置表示拓扑配置val个任务,这val个任务被平均分配给parallelism_hint个线程调用。(val/parallelism_hint平均分配)。
注意:JStorm中配置项:
> @DePRecated
T setNumTasks(Number val)
上面JStorm中给配置设置了方法过时了。
> /**
* define a new spout in this topoLOGy with the sPEcified parallelism. If
* the spout declares itself as non-distributed, the parallelism_hint will
* be ignored and only one task will be allocated to this component.
*
* @param id
* the id of this component. This id is referenced by other
* components that want to consume this spout's outputs.
* @param parallelism_hint
* the number of tasks that should be assigned to execute this
* spout. each task will run on a thread in a process somwehere
* around the cluster.
* @param spout
* the spout
*/
public SpoutDeclarer setSpout(String id, IRichSpout spout,
Number parallelism_hint)
JStorm设置的并行parallelism_hint,表示实例数目,也表示线程数目。数目一致。
觉得可用,就经常来吧! 脚本宝典 欢迎评论哦! js脚本,巧夺天工,精雕玉琢。小宝典献丑了!
以上是脚本宝典为你收集整理的javascript代码实例教程-JStorm/Strom配置executors和tasks(线程和实例)全部内容,希望文章能够帮你解决javascript代码实例教程-JStorm/Strom配置executors和tasks(线程和实例)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。