Storm分组策略

Storm学习02:八种grouping分组策略 简述 为拓扑中的每个 Bolt 的确定输入数据流是定义一个拓扑的重要环节。数据流分组定义了在 Bolt 的不同任务(tasks)中划分数据流的方式。 在 Storm 中有八种内置的数据流分组方式,而且还可以通过 CustomStreamGrouping接口实现自定义的数据流分组模型。(所以总共可以算是九种分组方式) 具体分组 这八种分组分时分别为: Shuffle grouping:随机分组。... 阅读详情

1. allGrouping全分组,相当于广播

      builder.setSpout("spout", new MySpout(), 2);

      builder.setBolt("bolt", new MyBolt(), 3).allGrouping("spout").setNumTasks(2);

bolt的2个task,每个executor执行1个,所以共开启2个bolt线程,2个bolt对象
PC201312272159,7532,Thread-26-spout-executor[5 5],MySpout@1697915218,open
PC201312272159,7532,Thread-28-spout-executor[4 4],MySpout@1116487711,open
PC201312272159,7532,Thread-26-spout-executor[5 5],MySpout@1697915218,nextTuple(hello world index=0Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-26-spout-executor[5 5],MySpout@1697915218,nextTuple(hello world index=1Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-26-spout-executor[5 5],MySpout@1697915218,nextTuple(hello world index=2Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-28-spout-executor[4 4],MySpout@1116487711,nextTuple(hello world index=0Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-28-spout-executor[4 4],MySpout@1116487711,nextTuple(hello world index=1Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-28-spout-executor[4 4],MySpout@1116487711,nextTuple(hello world index=2Thread-28-spout-executor[4 4])

PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,prepare()
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,prepare() 
PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,execute(hello world index=0Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,execute(hello world index=1Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,execute(hello world index=2Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,execute(hello world index=1Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-20-bolt-executor[3 3],MyBolt@471749353,execute(hello world index=2Thread-28-spout-executor[4 4]) 
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=0Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=0Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=1Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=2Thread-26-spout-executor[5 5])
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=1Thread-28-spout-executor[4 4])
PC201312272159,7532,Thread-18-bolt-executor[2 2],MyBolt@1008687601,execute(hello world index=2Thread-28-spout-executor[4 4])

 

                                      (图中间应该是allgroup)

2. shuffleGrouping 随机分组

      builder.setSpout("spout", new MySpout(), 2);

      builder.setBolt("bolt", new MyBolt(),2).shuffleGrouping("spout").setNumTasks(6);

PC201312272159,8172,Thread-18-spout-executor[8 8],MySpout@2007385198,open//故意设置的task多于executor, 2个executor,各运行一个task,造成另外4个task资源浪费

PC201312272159,8172,Thread-22-spout-executor[9 9],MySpout@1341389966,open

PC201312272159,8172,Thread-18-spout-executor[8 8],MySpout@2007385198,nextTuple(hello world index=0Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-18-spout-executor[8 8],MySpout@2007385198,nextTuple(hello world index=1Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-18-spout-executor[8 8],MySpout@2007385198,nextTuple(hello world index=2Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-22-spout-executor[9 9],MySpout@1341389966,nextTuple(hello world index=0Thread-22-spout-executor[9 9])

PC201312272159,8172,Thread-22-spout-executor[9 9],MySpout@1341389966,nextTuple(hello world index=1Thread-22-spout-executor[9 9])

PC201312272159,8172,Thread-22-spout-executor[9 9],MySpout@1341389966,nextTuple(hello world index=2Thread-22-spout-executor[9 9])

//6个task,就是6个bolt实例

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@1183510072,prepare()

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@618405619,prepare()

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@1609598998,prepare()

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@1060412223,prepare()

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@838038185,prepare()

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@902623311,prepare()

// 实际只启用来2个task

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@1183510072,execute(hello world index=0Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@1183510072,execute(hello world index=0Thread-22-spout-executor[9 9])

PC201312272159,8172,Thread-26-bolt-executor[5 7],MyBolt@1183510072,execute(hello world index=1Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@1060412223,execute(hello world index=1Thread-22-spout-executor[9 9])

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@1060412223,execute(hello world index=2Thread-18-spout-executor[8 8])

PC201312272159,8172,Thread-28-bolt-executor[2 4],MyBolt@1060412223,execute(hello world index=2Thread-22-spout-executor[9 9])

3. directGrouping 定向分组

builder.setSpout("spout", new MySpout(), 2);
builder.setBolt("bolt", new MyBolt(),2).directGrouping("spout").setNumTasks(6);

int taskid = 0;
Map<Integer, String> map = context.getTaskToComponent();
for (Map.Entry<Integer, String> entry : map.entrySet()) {
	if ("bolt".equals(entry.getValue())) {
		taskid = entry.getKey();
		break;
	}
}	
collector.emitDirect(taskid, new Values(line));
//2个spout
PC201312272159,3084,Thread-22-spout-executor[9 9],MySpout@1200934567,open
PC201312272159,3084,Thread-18-spout-executor[8 8],MySpout@1808556554,open
PC201312272159,3084,Thread-18-spout-executor[8 8],MySpout@1808556554,nextTuple(hello world index=0Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-18-spout-executor[8 8],MySpout@1808556554,nextTuple(hello world index=1Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-18-spout-executor[8 8],MySpout@1808556554,nextTuple(hello world index=2Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-22-spout-executor[9 9],MySpout@1200934567,nextTuple(hello world index=0Thread-22-spout-executor[9 9])
PC201312272159,3084,Thread-22-spout-executor[9 9],MySpout@1200934567,nextTuple(hello world index=1Thread-22-spout-executor[9 9])
PC201312272159,3084,Thread-22-spout-executor[9 9],MySpout@1200934567,nextTuple(hello world index=2Thread-22-spout-executor[9 9])
//6个bolt,实际只向其中1个bolt发送数据
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,prepare()
PC201312272159,3084,Thread-26-bolt-executor[5 7],MyBolt@1528181603,prepare()
PC201312272159,3084,Thread-26-bolt-executor[5 7],MyBolt@698713305,prepare()
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1215572847,prepare()
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@225885189,prepare()
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=0Thread-22-spout-executor[9 9])
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=0Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=1Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=2Thread-18-spout-executor[8 8])
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=1Thread-22-spout-executor[9 9])
PC201312272159,3084,Thread-28-bolt-executor[2 4],MyBolt@1280030270,execute(hello world index=2Thread-22-spout-executor[9 9])

 

4. Global grouping:只发送到一个Bolt中去执行。发送到最小的task上去执行,就是directGrouping的特例而已

 

嵌入式铁头山羊stm32-GPIO的四种输入模式-Day5 本文详细解析了GPIO的输入结构和工作原理,包括上拉/下拉模式、悬空设计、保护二极管机制等关键内容。重点阐述了不同输入模式下电流流向与电压变化,解释了上拉/下拉电阻、施密特触发器、保护二极管等元件的作用。特别对保护二极管的工作机制进行深入分析,说明其在过压/欠压时的钳位保护功能。同时解答了关于电压差、电流方向、负电压等常见疑问,并强调GPIO设计的灵活性(可配置上拉/下拉/悬空)是为了适应不同外设需求。全文通过电路分析和生活类比,帮助读者理解GPIO输入电路的工作原理和设计考量。 阅读详情

相关推荐

OpenHarmony 4.1/5.0 Beta上手:如何用ArkUI在非华为设备上开发你的第一个“鸿蒙”应用

本文详细介绍了如何在非华为设备上使用ArkUI开发OpenHarmony应用,涵盖从设备选型、环境搭建到应用部署的全流程。通过实战案例展示ArkTS语言在开源鸿蒙生态中的应用,帮助开发者突破设备限制,构建跨平台鸿蒙应用。

weixin_33704234的博客 366

Storm之分组策略

Storm由数源泉spout到bolt时,可以选择分组策略,实现对spout发出的数据的分发。对多个并行度的时候有用。 一、Storm的数据分发策略 1. Shuffle Grouping随机分组,随机派发stream里面的tuple,保证每个bolt task接收到的tuple数目大致相同。轮询,平均分配 2. Fields Grouping(相同fields去分发到同一个Bolt)按...

lixinkuan的博客 1057

ISP之LSC(Lens Shading Correction)

LSC - Lens Shading Correction即镜头暗影校正。

IQ_WXY的博客 5097

storm教程(五):storm消息的可靠性保障与acker机制、Thrift client 集群监控

消息的可靠性保障与acker机制Storm 能够保证每一个由 Spout 发送的消息都能够得到完整地处理。本文详细解释了 Storm 如何实现这种保障机制,以及作为用户如何使用好 Storm 的可靠性机制。 消息的“完整性处理”是什么意思 一个从 spout 中发送出的 tuple 会产生上千个基于它创建的 tuples。例如,有这样一个 word-count 拓扑:TopologyBuilde

风中云彩的博客 1800

Android Settings 设置Preference置灰显示

使Preference置灰显示,不能点击。先调用Preference的setEnabled(false),再调用setShouldDisableView(true); 如果使置灰项恢复正常可点击,可调用setEnabled(true)。

随风而动 1048

3分钟学会SQL中的断点去重技术,轻松搞定连续重复数据去重问题?

传感器采集的温度数据中,存在连续重复的值,需仅在数值变化时保留记录(例如:温度从 25°C 变为 26°C 时记录一次)。:判断逻辑,current_value!若当前温度与前一行的温度不同(或为第一条记录),则保留该行。的技术,常用于时间序列或状态日志中。:将连续相同值的记录合并,只保留断点处的记录。保留断点处的记录(即温度变化时的第一条)。原始数据表 sensor_data。最终仅保留值变化的断点记录。获取前一行的温度值。

石榴姐yyds 1019

大数据_Storm_教程二_Storm的基本设置

Storm 可以在Topology 中使用 代码 对 Storm 进行配置。 通过配置可以进行调控,达到优化的效果 下面以Java代码进行举例,示范下可进行的配置 1.设置一个 Topology 中用的 worker / slot 数量。  Tips:  worker 对应的是slots,  即 worker 与 slot (槽,最终的端口)是一对一

迎难而上 4150

6.4 实战项目:基于Agent内核构建Code Review智能体

本文介绍了一个基于Agent内核构建的智能Code Review系统实战项目。系统采用多Agent协作架构,包含代码质量分析、安全漏洞识别、性能优化建议等核心功能模块。文章详细展示了系统架构设计,采用协调器Agent管理多个专业Agent协同工作,并提供了基础Agent框架和协调器Agent的TypeScript实现代码。项目结合了AI Agent核心原理和多Agent协作机制,实现了自动化的代码审查流程,能够生成详细的审查报告,帮助开发者提升代码质量和安全性。

yonggeit的博客 3109

Storm大数据处理

1.hadoop有master与slave,Storm与之对应的节点是什么? 2.Storm控制节点上面运行一个后台程序被称之为什么? 3.Supervisor的作用是什么? 4.Topology与Worker之间的关系是什么? 5.Nimbus和Supervisor之间的所有协调工作有master来完成,还是Zookeeper集群完成? 6.storm稳定的原因是什么? 7.如何运行Topology? strom jar all-your-code.jar backtype.storm.MyTopolog

u014659211的专栏 1539

【ArcGIS风暴】Win10操作系统ArcGIS许可License无法启动的解决方法汇总(绝对成功!)

文章目录1. 关闭Windows Defender2. 关闭系统防火墙3. 删除迈克菲(McAfee)杀毒软件4. 在系统服务中启动 在安装ArcGIS软件时,最重要的一步是许可服务的正常启动,通常,由于各种各样的原因,ArcGIS许可管理器License Manager十有八九会无法启动,点N多次都没反应,如果许可服务不能如愿启动的话,即使Desktop安装成功,也是无法打开的。本文汇总了Win10操作系统之上ArcGIS安装过程中可能会导致服务无法启动的原因及解决办法。 ArcGIS安装参考教程:

智慧空间实验室 2万+

LeRobot 入门教程(一)软件环境、部署流程及摄像头配置

🤖 LeRobot:开源机器人学习平台 摘要:LeRobot是一个基于PyTorch的开源机器人学习平台,提供模型、数据集和工具,旨在降低机器人技术门槛。平台包含经过验证的模仿学习和强化学习方法,并提供预训练模型、人类演示数据集及模拟环境。安装需从源码获取,支持Python 3.10环境,可选扩展包括仿真环境(如gym-aloha)、电机控制(Dynamixel/Feetech SDK)和实验跟踪(Weights & Biases)。该平台托管在HuggingFace,并设有社区Discord频道

2506_90492529的博客 3417

Storm环境配置及吞吐量测试调优总结

Storm环境配置及吞吐量测试调优总结 2017年10月19日 17:03:53 阅读数:10867 问题导读 1.本文集群环境是什么? 2.配置中worker和slot是什么关系? 3.吞吐量是如何测试的?   1、硬件配置信息   6台服务器,2个CPU,96G,6核,24线程   2、集群信息   Storm集群:1个nimbus,6个supervisor ni...

大JAVA解决方案 1400

基于STM32F4XX 、HAL库的GXHT30C温湿度传感器驱动应用C语言程序设计

define GXHT30C_STATUS_WRITE_CHK (1 << 0) // 写数据校验状态。#define GXHT30C_STATUS_HUMI_TRACK (1 << 11) // 湿度跟踪报警。#define GXHT30C_STATUS_TEMP_TRACK (1 << 10) // 温度跟踪报警。#define GXHT30C_STATUS_CMD_STATUS (1 << 1) // 命令执行状态。

PP_Cottage的博客 226

Storm的流分组策略

原文地址:https://www.cnblogs.com/cutd/p/6740179.html 首先我要强调的是,Storm的分组策略对结果有着直接的影响,不同的分组的结果一定是不一样的。其次,不同的分组策略对资源的利用也是有着非常大的不同,本文主要讲一讲localOrShuffle这个分组对资源利用的重大改善。最后,不同的分组对项目的逻辑也起着至关重要的决定,比如在写数据的时候不同的分组策略...

learn_tech的博客 680

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

storm的分组策略

storm有7种流分组策略: 1:shuffle Grouping 随机分组;将tuple随机分配到bolt中,能够保证各bolt中处理的数据均衡; 2:Fields Grouping 按字段分组; 根据设定的字段相同值得tuple被分配到同一个bolt进行处理; 举例:builder.setBolt("mybolt", new MyStoreBolt(),5).fieldsGroupi

天空色彩图 2359

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

简单聊聊Storm的流分组策略

简单聊聊Storm的流分组策略 首先我要强调的是,Storm的分组策略对结果有着直接的影响,不同的分组的结果一定是不一样的。其次,不同的分组策略对资源的利用也是有着非常大的不同,本文主要讲一讲localOrShuffle这个分组对资源利用的重大改善。最后,不同的分组对项目的逻辑也起着至关重要的决定,比如在写数据的时候不同的分组策略会导致死锁。 简单理解数据流分组 拓扑定义的一部分就是为每个B...

LzwGlory的专栏 301

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

storm的流分组策略

storm中有多个bolt和多个spout,他们之间会有多种连接方式,他们之间的tulpe也是多种传递方式,正是有了这些灵活的分组策略,才使得storm可以分层处理,每层bolt都只做自己的事情 storm里面有7种 stream grouping 1.shuffle grouping 2.fields grouping 3.all grouping 4.global group...

zhangsir的博客 9083

storm分组策略

1、Stream Grouping概述 随机分组:元组以一定方式随机分布在螺栓任务上,从而确保每个螺栓都具有相等数量的元组。 字段分组:流按分组中指定的字段进行分区。例如,如果流按“ user-id”字段分组,则具有相同“ user-id”的元组将始终执行相同的任务,但是具有不同“ user-id”的元组可能会执行不同的任务。 部分密钥分组:流按分组中指定的字段进行分区(如“字段”分组),但在两个下游螺栓之间进行负载平衡,当输入数据倾斜时,可以更好地利用资源。本文对它的工作原理和优点提供了很好的解释。 全部

zhaoxiaoba123的博客 613

storm分组策略介绍

[size=medium][b]一、storm数据来源[/b][/size] Spout的数据源: MQ:直接流数据源 Db:只能读配置文件 文件:只能学习用,其他无用。 问题:1、分布式应用无法读;2、spout开并发会重复读 Log文件增量数据:1、读出内容写入MQ,2、Storm处理 [size=medium][b]二、分组策略[/b][/size] st...

futureofstar的博客 400

Storm 分组策略和并发度

分组策略和并发度 一、Stream Grouping 所谓的分组策略就是在Spout与Bolt、Bolt与Bolt之间传递Tuple的方式。 stream grouping用来定义一个stream应该如何分配给Bolts上面的多个Executors(多线程、多并发)。 Stream grouping的类型 Storm里面有7种 1)Shuffle Grouping: 随机分组,轮询,平均分配。随机...

x6x6x6x的博客 440

storm 的分组策略深入理解(-)

目录 storm的分组策略 根据实例来分析分组策略 common配置: Shuffle grouping shuffle grouping的实例代码 ShuffleGrouping 样例分析 Fields grou...

weixin_30825581的博客 259

Storm拓扑并行度与及流分组策略

目录一、Storm拓扑的并行度(parallelism)介绍(1)运行拓扑的结构(2)配置拓扑的并行度(1)工作进程Worker数量(2)执行器Executor数量(3)任务Task数量(3)改变运行中拓扑的并行度二、Streaming Groupings流分组策略三、基于流分组策略应用程序的开发 一、Storm拓扑的并行度(parallelism)介绍 (1)运行拓扑的结构 工作进程: Worker Process,也称为Worker 执行器: Executor,即线程Thread 任务: Task 工作

蔡政洁的博客 833

五、Storm分组策略与可靠性

一、分组策略: 1、Stream Grouping概述: A stream grouping defines how that stream should be partitioned among the bolt's tasks http://storm.apache.org/releases/1.1.2/Concepts.html 8种分组策略; ①Shuffle grouping:...

qq_1306238492的博客 209

【Storm篇】--Storm分组策略

========================================================= 声明:由于不同平台阅读格式不一致(尤其源码部分),所以获取更多阅读体验!! 请关注本人博客园地址:http://www.cnblogs.com/LHWorldBlog/ 个人网站地址:http://www.lhworldblog.com/ ================

L先生AI课堂 725
上一篇: Storm-1.0.3完全分布式安装
下一篇: numpy初体验
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值