Advertisement

Kafka硬核干货

阅读量:

目录

Kafka

Kafka Producer

Kafka Consumer

Consumer Offset

Log Manager

如何实现高吞吐、低延迟

顺序读写

PageCache

零拷贝

落地

参考


Kafka

Kafka 是 Apache 软件基金会开发的一个开源流数据处理平台,主要由 Scala 和 Java 语言实现。该平台的主要目标是为高效处理实时流数据提供一个具有高处理能力、传输延迟低的解决方案。

A streaming platform is equipped with three key capabilities: it offers publication and subscription services for streaming records, akin to a message queue or enterprise messaging system. It ensures records are stored in a fault-tolerant manner. It processes streams in real-time as they occur.

Kafka is typically employed for two primary categories of applications: Constructing real-time streaming data pipelines that ensure seamless data transfer between systems or applications. Constructing real-time streaming applications that process or respond to data streams. Implementing asynchronous separation for peak load management.

First, a few key concepts: Kafka functions as a distributed cluster managed across one or more servers, which can be deployed across multiple datacenters. The Kafka cluster is designed to store streams of data records organized into topics. Each record within the cluster comprises a key, a value, and a timestamp, enabling efficient data processing and retrieval.

Broker :Kafka 集群包含一个或多个服务器,这种服务器被称为 broker

每条消息发布至Kafka集群时都会被归类为一个类型,这个类型被称为 topic。

Partition: 每个 topic 包含一个或多个 partition

Producer: 负责发布消息到 Kafka broker

Consumer :消费消息,每个consumer属于一个特定的 consumer group

Kafka Producer

支持常用语言客户端,包括 C/C++、Python、Go 等语言

Kafka Consumer

Consumer Offset

Log Manager

如何实现高吞吐、低延迟

  1. 分区分段
  2. 批量处理
  3. 数据压缩
  4. 顺序读写
  5. PageCache
  6. 零拷贝

顺序读写

尽管即使是最先进的固态硬盘(闪存),其寻道时延也比传统磁盘更低,但在随机访问模式和顺序访问模式之间仍存在显著的速度差距,这一差距约为四个数量级。

该系统采用6块7200rpm SATA RAID-5阵列JBOD架构,实现在单位时间内可处理的大量数据。具体而言,该系统在线性写入模式下表现出色,每秒处理600MB的数据。然而,随机写入的效率显著下降,仅能达到每秒100KB,两者性能差距达到惊人的6000倍。

PageCache

为了有效弥补性能差距,现代操作系统积极采用主内存进行磁盘缓存,从而在访问磁盘时避免直接进行I/O操作。即使进程维护了数据缓存,数据也可能在PageCache中重复,从而导致数据缓存两次。此外,Kafka架构基于JVM平台。

零拷贝

落地

参考

访问地址:https://kafka.apache.org

http://varnish-cache.org/docs/trunk/phk/notes.html

该版本将推出一系列新功能,丰富用户的选择
该技术架构将支持最大容量的分布式处理

<Kafka 权威指南>

<深入理解Kafka:核心设计与实现原理>

全部评论 (0)

还没有任何评论哟~