
kafka
文章平均质量分 63
腹黑客
骑最贵的单车,你就是gai上最靓的仔
展开
-
Kafka Consumer 消费 多线程vs多实例
Kafka Consumer消费性能提升针对一下两种方案进行对比,并通过代码检验。1. 方案一在同一个Consumer Group中,创建多个Consumer,增加消费者性能。创建Topicbin/kafka-topics.sh --create --zookeeper master:2181 --replication-factor 1 --partitions 10 --topic mul_consumer_10表格中展示出不同Consumer实例下的执行结果:Consume原创 2021-03-23 16:54:11 · 2617 阅读 · 0 评论 -
Kafka 性能测试
Kafka 性能测试(基于Kafka 2.2.1版本)Producer 测试1. 不同压缩算法对数据发送性能的影响测试命令3 broker , 2 replication , numRecords 500w , throughput 100w , recordSize 256bytebin/kafka-producer-perf-test.sh --producer-props bootstrap.servers=master:9092 compression.type=none --top原创 2021-03-09 18:55:32 · 791 阅读 · 0 评论 -
Kafka - Log Segment read方法解析
Log Segment read 方法源码解析read方法执行流程图:第一步:查找索引确定读取物理文件位置val startOffsetAndSize = translateOffset(startOffset)/** * Find the physical file position for the first message with offset >= the requested offset. 查找偏移量>=请求的偏移量的第一条消息的物理文件位置。 * *原创 2021-02-26 10:59:12 · 337 阅读 · 0 评论 -
Kafka LogSegment append方法源码解读
Log Segment的源码解析Kafka日志在磁盘上的组织架构:LogSegment 的 append写入流程图第一步:判断当前日志段是否为空val physicalPosition = log.sizeInBytes() //当前日志段位移if (physicalPosition == 0) //如果是空,记录用于切分日志段依据 rollingBasedTimestamp = Some(largestTimestamp) // largestTimestamp: Long, 当前这批消原创 2021-02-25 18:32:32 · 334 阅读 · 0 评论