当前位置: 首页 > news >正文

Kafka broker 写消息的过程

Producer → Kafka Broker → Replication → Consumer|Partition chosen (by key or round-robin)|Message appended to end of log (commit log)

上面的流程是kafka 写操作的大体流程。

kafka 不会特意保留message 在内存中,而是直接写入了disk。
那么消费的时候,如果是最近 produced 的message,即使写入了disk,还是会保留在OS的page cache中。 OS page cache 即使是flush 到了disk,也不会被立刻清除,这个是OS 自己的机制。 所以consumer 读最近生产的消息的时候,还是可以从page cache中读取出来的,而不用从disk 中读取。

  1. Kafka Broker Receives the Message
    决定partition

  2. Message is Appended to a Partition Log
    The selected broker appends the message to the end of the partition log (a sequential write).
    Kafka writes messages to disk efficiently using write-ahead logs (WAL).

  3. Replication (for Fault Tolerance)
    Kafka waits for acknowledgments based on the producer’s acks setting:
    acks=0: Producer doesn’t wait.
    acks=1: Wait for leader only.
    acks=all: Wait for all replicas to acknowledge.

  4. Message is Made Available to Consumers
    Once the acks is fulfilled, it becomes available for consumers.
    Consumers read sequentially using offsets.
    Kafka keeps messages for a retention period (e.g., 7 days), regardless of whether they’ve been consumed.

http://www.lqws.cn/news/136171.html

相关文章:

  • UE 材质基础第三天
  • 细说C语言将格式化输出到字符串的函数sprintf、_sprintf_l、swprintf、_swprintf_l、__swprintf_l
  • MP4文件声音与视频分离
  • 网络寻路--图论
  • C语言数据结构笔记3:Union联合体+结构体取8位Bool量
  • 嵌入式常见 CPU 架构
  • 传输层协议 UDP 介绍 -- UDP 协议格式,UDP 的特点,UDP 的缓冲区
  • 激光干涉仪:解锁协作机器人DD马达的精度密码
  • [Java 基础]类,面向对象的蓝图
  • ABP-Book Store Application中文讲解 - Part 9: Authors: User Interface
  • AWS中国区IAM相关凭证自行管理策略(只读CodeCommit版)
  • Linux容器篇、第一章docker命令总结表
  • C++入门基础
  • JavaScript基础:运算符
  • 本地IP配置
  • 【电赛培训课程】电子设计竞赛工程基础知识
  • psycopg2-binary、pgvector、 SQLAlchemy、 PostgreSQL四者的关系
  • typescript中的type如何使用
  • FSC认证概述?FSC认证的核心原则与标准?FSC认证的市场价值与意义
  • QRSuperResolutionNet:一种结构感知与识别增强的二维码图像超分辨率网络(附代码解析)
  • SSH登陆Linux常见问题大全
  • RAMSUN分享全新超值型MM32F0050系列MCU
  • 航芯MCU使用IAR+Jlink调试
  • 关于单片机的基础知识(一)
  • yFiles:专业级图可视化终极解决方案
  • Maskrcnn网络结构学习
  • DataStreamAPI实践原理——快速上手(实操详细版)
  • AbMole|Temozolomide在胶质母细胞瘤研究中为什么会常用到?
  • 300道GaussDB(WMS)题目及答案。
  • 2506,wtl的通知事件