kafka的并行度与JStorm性能优化
kafka的并行度与JStorm性能优化
> Consumers
Messaging traditionally has two models: queuing and publish-subscribe. In a queue, a pool of consumers may read from a server and each message goes to one of them; in publish-subscribe the message is broadcast to all consumers. Kafka offers a single consumer
abstraction that generalizes both of these—the consumer group.
Consumers label themselves with a consumer group name, and each message published to a topic is delivered to one consumer instance within each subscribing consumer group. Consumer instances can be in separate processes or on separate machines.
If all the consumer instances have the same consumer group, then this works just like a traditional queue balancing load over the consumers.
If all the consumer instances have different consumer groups, then this works like publish-subscribe and all messages are broadcast to all consumers.
More commonly, however, we have found that topics have a small number of consumer groups, one for each "logical subscriber". Each group is composed of many consumer instances for scalability and fault tolerance. This is nothing more than publish-subscribe semantics
where the subscriber is cluster of consumers instead of a single process.
> Kafka has stronger ordering guarantees than a traditional messaging system, too.....
> Kafka does it better. By having a notion of parallelism—the partition—within the topics, Kafka is able to provide both ordering guarantees and load balancing over a pool of consumer processes. This is achieved by assigning the partitions in the topic to the
consumers in the consumer group so that each partition is consumed by exactly one consumer in the group. By doing this we ensure that the consumer is the only reader of that partition and consumes the data in order. Since there are many partitions this still
balances the load over many consumer instances. Note however that there cannot be more consumer instances than partitions.
Kafka only provides a total order over messages within a partition, not between different partitions in a topic. Per-partition ordering combined with the ability to partition data by key is sufficient for most applications. However, if you require a total order
over messages this can be achieved with a topic that has only one partition, though this will mean only one consumer process.
我们经经常使用的是公布-订阅方式。
消费者端能够组成一个组。共同消费一个topic。kafka 中topic的消息每个消息仅仅能被消费者组中的一个消费者消费,能够把消费者组的消费者个数当作线程数目,多个线程消费某一topic消息。
消费者实例能够在不同机器上的不同进程内。
假设某一topic的全部消费者实例都有同样的消费组名。它们的工作方式类似与传统的队列。
假设某一topic的全部消费者实例有各自不同的消费组名。它们的工作方式类似与公布-订阅,全部的消息广播给 全部消费者。
为什么採用消费组的形式呢,文档也给出了答案:for scalability and fault tolerance。
kafka的并行度---分区(the partition),
文档指出:某一topic的消息的每一个分区(partition)被一个消费组中的一个消费者消费,能够确保消费者消费的顺序。
Note however that there cannot be more consumer instances than partitions.不要使得消费组中消费者实例数目多于分区数目,相等最好。
JStorm中。spout是拓扑图中的入口点,假设这个入口流量小了,整个拓扑中的瓶颈那应该是入口了。所以,我们在JStorm中,kafkaSpout要提高并发度。设置kafkaSpout实例数目,设置的实例数目要和kafka分区的数目相等,我们随时调整分区数目及kafkaSpout实例数目,观察性能瓶颈存在否。
kafka的并行度与JStorm性能优化的更多相关文章
- 漫游Kafka设计篇之性能优化
Kafka在提高效率方面做了很大努力.Kafka的一个主要使用场景是处理网站活动日志,吞吐量是非常大的,每个页面都会产生好多次写操作.读方面,假设每个消息只被消费一次,读的量的也是很大的,Kafka也 ...
- apache kafka系列之性能优化架构分析
apache kafka中国社区QQ群:162272557 Apache kafka性能优化架构分析 应用程序优化:数据压缩 watermark/2/text/aHR0cDovL2Jsb2cuY3Nk ...
- Spark性能优化(1)——序列化、内存、并行度、数据存储格式、Shuffle
序列化 背景: 在以下过程中,需要对数据进行序列化: shuffling data时需要通过网络传输数据 RDD序列化到磁盘时 性能优化点: Spark默认的序列化类型是Java序列化.Java序列化 ...
- 漫游Kafka设计篇之性能优化(7)
Kafka在提高效率方面做了很大努力.Kafka的一个主要使用场景是处理网站活动日志,吞吐量是非常大的,每个页面都会产生好多次写操作.读方面,假设每个消息只被消费一次,读的量的也是很大的,Kafka也 ...
- 一文告诉你,Kafka在性能优化方面做了哪些举措!
很多粉丝私信问我Kafka在性能优化方面做了哪些举措,对于相关问题的答案其实我早就写过了,就是没有系统的整理一篇,最近思考着花点时间来整理一下,下次再有粉丝问我相关的问题我就可以潇洒的甩个链接了.这个 ...
- 5种kafka消费端性能优化方法
摘要:带你了解基于FusionInsight HD&MRS的5种kafka消费端性能优化方法. 本文分享自华为云社区<FusionInsight HD&MRSkafka消费端性能 ...
- Storm 性能优化
目录 场景假设 调优步骤和方法 Storm 的部分特性 Storm 并行度 Storm 消息机制 Storm UI 解析 性能优化 场景假设 在介绍 Storm 的性能调优方法之前,假设一个场景:项目 ...
- storm性能优化
Storm 性能优化 目录 场景假设 调优步骤和方法 Storm 的部分特性 Storm 并行度 Storm 消息机制 Storm UI 解析 性能优化 场景假设 在介绍 Storm 的性能调优方法之 ...
- Storm: 性能优化 (转载)
Storm 性能优化 原文地址:http://www.jianshu.com/p/f645eb7944b0 目录 场景假设 调优步骤和方法 Storm 的部分特性 Storm 并行度 Storm 消 ...
随机推荐
- 解读TDD的五大误区
所谓TDD简单地说就是以下两个步骤:确保所有的需求都能被照顾到:在代码不断增加和重构的过程中,可以检查所有的功能是否正确.本文我们一起来看下关于TDD的五大误区. TDD(全称Test Driven ...
- JAVA常见算法题(二十)
package com.xiaowu.demo; /** * * 打印出如下图案(菱形) * * * * @author WQ * */ public class Demo20 { public st ...
- 《JAVA核心卷I》之Java基本程序结构
Java基本程序结构 1.类名是以大写字母开头的名词代码能够执行的类,要有main函数,且声明必须是public 2.注释: “//”,"/**/" 行注释 "/** ...
- 简谈WP,IOS,Android智能手机OS
什么是智能手机? 相信到现在这个已经是傻瓜到不能再傻瓜的问题了 智能手机都不懂? 那你活着还有什么意思= = 但是为了谈论今天的三大主角:wp,ios,android 不得不回答一下这个笨笨的问题 如 ...
- 2017.4.26 慕课网--Java 高并发秒杀API(一)
Java高并发秒杀API系列(一) -----------------业务分析及Dao层 第一章 课程介绍 1.1 内容介绍及业务分析 (1)课程内容 SSM框架的整合使用 秒杀类系统需求理解和实现 ...
- 使用PowerDesigner进行代码生成
很多代码生成器都选择了从表结构来生成领域模型,这样的方案有一个前提,就是领域模型和数据库表结构是同构的,也就是说领域模型中的类和数据库中的记录结构十分吻合,这样数据库表结构可以简单的直接映射到领域模型 ...
- 使用Kinect2作为Oculus游戏应用的输入设备
注: 文章写于2015年8月, 眼下VR游戏Demo已经完结, 所以把上一次预研的一些经验分享出来, 希望对大家有所帮助 背景 初接触Oculus时, 从网上下载了一大堆的Demo来体验, 可是, 操 ...
- UI自动化测试篇 :Selenium2(Webdriver)&TestNG自动化测试环境搭建
最开始学习UI自动化,用的工具是QTP10,用起来确实比较容易上手,自学了没多久,大家都说QTP过时了.这么好用的的工具怎么一下子就过时了呢?因为它的“笨重”,因为它作为商业软件带来的巨大使用成本,还 ...
- 仿苹果电脑任务栏菜单&&拼图小游戏&&模拟表单控件
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Windows网页上碰到无法完全显示的图片怎么办
如图所示,下一幅图片只能显示一半. 我们选中并在新标签中打开 一般即可正常显示,如果还不行,留意地址栏,这就是这个图片的真实地址,我们完全可以用迅雷直接把这幅图片下载下来. 我们甚至可以猜测,去掉后缀 ...