这篇文件翻译自 http://www.michael-noll.com/blog/2013/06/21/understanding-storm-internal-message-buffers/

当进行Storm调优时,理解Storm内部消息队列的配置十分有帮助。这篇文件将说明在Storm 0.8/0.9版本中一个Worker内部的消息通信。

Storm Worker进程内部消息传输

这里所说的“内部消息”是指单台节点上的一个Worker进程内部的消息。这种通信依赖于Storm内部各种 LMAX Disrupter(高性能多线程消息库) 支持的消息队列。

单个Worker进程内部多线程通信不同于多个worker进程之间的通信。后者通常跨网络或者机器,Storm采用 Zero MQ/Netty进行支持。

  • Intra-worker communication in Storm (inter-thread on the same Storm node): LMAX Disruptor
  • Inter-worker communication (node-to-node across the network): ZeroMQ or Netty
  • Inter-topology communication: nothing built into Storm, you must take care of this yourself with e.g. a messaging system such as Kafka/RabbitMQ, a database, etc.

事例说明

Storm内部消息队列概要。Worker进程的消息队列标识为红色,Worker内部Executer的消息队列标识为绿色。图中为了可读性,只有一个Worker和一个Executor,而现实中通常有多个Worker,一个Worker中也可能有多个Executors。

详细描述

Worker进程

为了管理进来和出去的消息,每个Worker进程有一个监听TCP端口(configured by supervisor.slots.ports)的接收线程。类似的,每个Worker有一个发送线程负责将从transfer queue中读到的消息发送到下游消费者。

  • The topology.receiver.buffer.size is the maximum number of messages that are batched together at once for appending to an executor’s incoming queue by the worker receive thread (which reads the messages from the network) Setting this parameter too high may cause a lot of problems (“heartbeat thread gets starved, throughput plummets”). The default value is 8 elements, and the value must be a power of 2 (this requirement comes indirectly from LMAX Disruptor).
  • // Example: configuring via Java API
    Config conf = new Config();
    conf.put(Config.TOPOLOGY_RECEIVER_BUFFER_SIZE, 16); // default is 8
  • Each element of the transfer queue configured with topology.transfer.buffer.size is actually a list of tuples. The various executor send threads will batch outgoing tuples off their outgoing queues onto the transfer queue. The default value is 1024 elements.
  • // Example: configuring via Java API
    conf.put(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE, 32); // default is 1024

Executors

一个Worker进程控制着一个或者多个Executer线程。每个Executor有自己的 incoming queue 和 outgoing queue

每个Executor有一个负责逻辑处理spout/bolt的线程, 一个接收消息线程,和一个发送消息线程。

  • The topology.executor.receive.buffer.size is the size of the incoming queue for an executor. Each element of this queue is a list of tuples. Here, tuples are appended in batch. The default value is 1024 elements, and the value must be a power of 2 (this requirement comes from LMAX Disruptor).
  • // Example: configuring via Java API
    conf.put(Config.TOPOLOGY_EXECUTOR_RECEIVE_BUFFER_SIZE, 16384); // batched; default is 1024
  • The topology.executor.send.buffer.size is the size of the outgoing queue for an executor. Each element of this queue will contain a single tuple. The default value is 1024 elements, and the value must be a power of 2 (this requirement comes from LMAX Disruptor).
  • // Example: configuring via Java API
    conf.put(Config.TOPOLOGY_EXECUTOR_SEND_BUFFER_SIZE, 16384); // individual tuples; default is 1024

[Storm] 内部消息缓存的更多相关文章

  1. Storm内部的消息传递机制

    作者:Jack47 转载请保留作者和原文出处 欢迎关注我的微信公众账号程序员杰克,两边的文章会同步,也可以添加我的RSS订阅源. 一个Storm拓扑,就是一个复杂的多阶段的流式计算.Storm中的组件 ...

  2. Apache Storm内部原理分析

    转自:http://shiyanjun.cn/archives/1472.html 本文算是个人对Storm应用和学习的一个总结,由于不太懂Clojure语言,所以无法更多地从源码分析,但是参考了官网 ...

  3. 交易系统使用storm,在消息高可靠情况下,如何避免消息重复

    概要:在使用storm分布式计算框架进行数据处理时,如何保证进入storm的消息的一定会被处理,且不会被重复处理.这个时候仅仅开启storm的ack机制并不能解决上述问题.那么该如何设计出一个好的方案 ...

  4. WebIM(2)---消息缓存

    WebIM系列文章 在一步一步打造WebIM(1)一文中,已经介绍了如何实现一个简单的WebIM,但是,这个WebIM有一个问题,就是每一次添加消息监听器时,都必须访问一次数据库去查询是否有消息,显然 ...

  5. nordic mesh中的消息缓存实现

    nordic mesh中的消息缓存实现 代码文件msg_cache.h.msg_cache.c. 接口定义 头文件中定义了四个接口,供mesh协议栈调用,四个接口如下所示,接口的实现代码在msg_ca ...

  6. 内部消息 微软中国云计算 内測Azure免费账号 赶紧申请 错过不再有

    内部消息 微软中国云计算 顶级内測Azure免费账号 火热申请 过期不再有! 微软MSDN俱乐部  29754721, [一大波Azure免费账号来袭]Windows Azure再次开启示放免费试用账 ...

  7. 6张图为你分析Kafka Producer 消息缓存模型

    摘要:发送消息的时候, 当Broker挂掉了,消息体还能写入到消息缓存中吗? 本文分享自华为云社区<图解Kafka Producer 消息缓存模型>,作者:石臻臻的杂货铺. 在阅读本文之前 ...

  8. 理解Storm可靠性消息

    看过一些别人写的, 感觉有些东西没太说清楚,个人主要以源代码跟踪,参考个人理解讲述,有错误请指正. 1基本名词 1.1 Tuple: 消息传递的基本单位.很多文章中介绍都是这么说的, 个人觉得应该更详 ...

  9. nginx+lua+storm的热点缓存的流量分发策略自动降级

    1.在storm中,实时的计算出瞬间出现的热点. 某个storm task,上面算出了1万个商品的访问次数,LRUMap 频率高一些,每隔5秒,去遍历一次LRUMap,将其中的访问次数进行排序,统计出 ...

随机推荐

  1. bash 操作 sqlite3

    首先,这是个奇怪的需求...但是遇到了.我参考后文链接里的方法,做了自己的. 表是自己手动建的,数据库名字叫 new.db: create table test (sn varchar(), name ...

  2. 使用 BASH 作为 CGI 进行 HTTP 文件上传

    憋半天憋出这么点代码来,暂时凑合可以用...需要手动删除文件末尾的分隔符,还有一个windows 换行: #!/bin/bash newline="" while true; do ...

  3. 使用dnsmasq来提升CentOS上网速度

    1. 安装dnsmasq dnsmasq的官方网址是:http://www.thekelleys.org.uk/dnsmasq/doc.html.利用里面的下载链接下载dnsmasq-2.72.tar ...

  4. Jquery 随便写些知识点

    针对jQuery随便写些觉得还挺实用的一些东西,也没系统的去理一番,只是想到哪写到哪,写的不完全也请多见谅. jQuery和其他javascript库产生$符号冲突了?$符号想必用jQuery的人都不 ...

  5. html内容写入到文件中的时候出现‘TypeError: expected a character buffer object’错误

    代码如下: with open('ryf.md', 'a') as f: f.write(content) # content是html内容 原因是写入文件要求写入内容是str,直接转换成str即可, ...

  6. BCE0019: '' is not a member of 'UnityEngine.Component'的问题

    看自学网上的Unity3D的视频,其中视频中的实力代码: n.rigidbody.AddForce(fwd * 28000); 这个代码运行会出现错误: BCE0144: 'UnityEngine.C ...

  7. POJ 1330 Nearest Common Ancestors (最近公共祖先LCA + 详解博客)

    LCA问题的tarjan解法模板 LCA问题 详细 1.二叉搜索树上找两个节点LCA public int query(Node t, Node u, Node v) { int left = u.v ...

  8. sql练习

  9. uC/OS-II信号(OS_sem)块

    /*************************************************************************************************** ...

  10. Java 性能优化技巧集锦

    摘要: =================================== 可供程序利用的资源(内存.CPU时间.网络带宽等)是有限的,优化的目的就是让程序用尽可能少的资源完成预定的任务.优化通常 ...