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

kakfa 基本了解

部署结构

Kafka 使用zookeeper来协商和同步,但是kafka 从版本3.5正式开始deprecate zookeeper, 同时推荐使用自带的 kraft. 而从4.0 开始则不再支持 zookeeper。
所以 kafka 是有control plane 和 data plane 的。
data plane 就是broker,control plane 旧的就是zookeeper,新的是 kRaft contorller。

kafka cluster的节点(broker)是没有leader 和 follower 之分的。
只是存储messages 的 topic partition 有。
Client只能connect partition 的leader 来写和读。

Partition Connection

kafka 术语

Kafka brokers: Brokers refer to each of the nodes in a Kafka cluster

The broker.id property is the unique and permanent name of each node in the cluster

Record:Records are also called messages or events. A Kafka record consists of headers, a key, a value, and a timestamp.

Headers contain metadata consisting of string-value pairs, which can be read by consumers in order to make decisions based on the metadata. Headers are optional.
Key and value pairs in a Kafka record contains data relevant to your business. The key may have some structure, and can be a string, an integer, or some compound value. The value is structured and is likely an object to be serialized.
Every Kafka record has a timestamp. If you don’t provide one, one is provided by default.

Message streams are persistent in Kafka. This means that messages do not disappear once received. This is in contrast with classic “pub-sub” systems such as JMS, which as soon as the message is received by the subscriber, is removed from the system. In Kafka, message retention periods are configurable, usually based on a length of time or the size of the underlying storage.
kafka 的message 是可以被多次消费的,不是消费后就被删除,而是通过 retention policy 来控制的。

在这里插入图片描述

Topic:Kafka topics are the categories used to organize messages, messages are sent to and read from specific topics.

Each topic has a name that is unique across the entire Kafka cluster.
And producers write data to topics, and consumers read data from topics.
Kafka topics are multi-subscriber.This means that a topic can have zero, one, or multiple consumers subscribing to that topic and the data written to it. There is a many-to-many relation between producers/consumers and topics.

在这里插入图片描述

Partition: Kafka topics are divided into one or more partitions, each of which is a logical segment of the topic’s data.

Each partition holds a subset of the topic’s data, and the producer decides which partition a message is written to, based on factors like a key or round-robin distribution.

client producer根据record 的 key 的hash 来分配topic 的partition. 如果没有key则round-robin 分配partition。
一个partition 只会分配给一个client,但是一个client 可能会handle 多个partition。

在这里插入图片描述

A topic can be divided into multiple partitions to enable parallel processing and improve scalability. Each partition is an ordered sequence of immutable records, with messages within a partition guaranteed to maintain their order. Partitions allow Kafka to distribute the workload of writing and reading messages across multiple brokers in the cluster. This enables consumers to read data in parallel, and producers to write data to different partitions simultaneously, increasing throughput and reducing latency.

Within each partition, messages have a unique offset, which is an integer representing their position in the sequence. This helps consumers track their position and retrieve messages in the correct order.

在这里插入图片描述

Kafka Transaction: A Kafka transaction is a group of operations (usually message writes or reads + writes) that are treated as a single atomic unit. Either all of the operations succeed, or none of them take effect.

** Transactions: Balance Overhead with Latency **

One thing to consider, specifically in Kafka Streams applications, is how to set the commit.interval.ms configuration. This will determine how frequently to commit, and hence the size of our transactions. There is a bit of overhead for each transaction so many smaller transactions could cause performance issues. However, long-running transactions will delay the availability of output, resulting in increased latency. Different applications will have different needs, so this should be considered and adjusted accordingly.

相关文章:

kakfa 基本了解

部署结构 Kafka 使用zookeeper来协商和同步,但是kafka 从版本3.5正式开始deprecate zookeeper, 同时推荐使用自带的 kraft. 而从4.0 开始则不再支持 zookeeper。 所以 kafka 是有control plane 和 data plane 的。 data plane 就是broker,control plane…...

基于Browser Use + Playwright 实现AI Agent操作Web UI自动化

Browser Use是什么 Browser Use是一个开源项目官网:Browser Use - Enable AI to control your browser,专为大语言模型(LLM)设计的只能浏览器工具,能够让AI像人类一样自然的浏览和操作网页,支持多标签页管…...

Origin绘制多因子柱状点线图

多因子柱状点线图是一种结合柱状图和点线图的复合图表,常用于同时展示多个因子(变量)在不同分组下的分布和趋势变化。 适用场景: (1)比较多个因子在不同分组中的数值大小(柱状图)&a…...

Web漏洞扫描服务的特点与优势:守护数字时代的安全防线

在数字化浪潮中,Web应用程序的安全性已成为企业业务连续性和用户信任的核心要素。随着网络攻击手段的不断升级,Web漏洞扫描服务作为一种主动防御工具,逐渐成为企业安全体系的标配。本文将从特点与优势两方面,解析其价值与应用场景…...

iOS 直播技术及优化

iOS直播技术的实现和优化涉及多个技术环节,需结合协议选择、编解码方案、播放器技术及性能调优等多方面。 一、核心技术实现 协议选择与传输优化 HLS(HTTP Live Streaming):苹果官方推荐,基于HTTP分片传输&#xff0c…...

抛弃传统P2P技术,EasyRTC音视频基于WebRTC打造教育/会议/远程巡检等场景实时通信解决方案

一、方案背景 随着网络通信发展,实时音视频需求激增。传统服务器中转方式延迟高、资源消耗大,WebP2P技术由此兴起。EasyRTC作为高性能实时通信平台,集成WebP2P技术,实现低延迟、高效率音视频通信,广泛应用于教育、医疗…...

俄罗斯军总参情报局APT28组织瞄准援乌后勤供应链发起全球网络攻击

2025年5月,由美国、英国、欧盟和北约网络安全与情报机构联合发布的最新网络安全公告披露,俄罗斯军总参情报局(GRU)第85特别服务中心第26165部队(又称APT28、Fancy Bear、Forest Blizzard和BlueDelta)正持续…...

杰发科技AC7801——PWM获取固定脉冲个数

测试通道6 在初始化时候打开通道中断 void PWM1_GenerateFrequency(void) {PWM_CombineChConfig combineChConfig[1]; //组合模式相关结构体PWM_IndependentChConfig independentChConfig[2];//独立模式相关结构体PWM_ModulationConfigType pwmConfig; //PWM模式相关结构体PWM…...

MacBookPro上macOS安装第三方应用报错解决方案:遇到:“无法打开“XXX”,因为无法确定(验证)开发者身份?怎么解决

MacBook Pro 上 macOS 安装第三方应用报错解决方案 —— 彻底搞定「无法打开“XXX”,因为无法确定开发者身份」 适用系统:macOS Catalina 10.15 ~ macOS Sonoma 14.x 适用机型:Intel / Apple Silicon 全系 MacBook Pro 文章目录 **MacBook P…...

MVC和MVVM架构的区别

MVC和MVVM都是前端开发中常用的设计模式,都是为了解决前端开发中的复杂性而设计的,而MVVM模式则是一种基于MVC模式的新模式。 MVC(Model-View-Controller)的三个核心部分:模型、视图、控制器相较于MVVM(Model-View-ViewModel)的三个核心部分…...

RAG(Retrieval-Augmented-Generation)检索增强生成

什么是RAG(检索增强生成)? RAG是一种AI框架,结合传统的数据检索技术和LLM(大语言模型)的优势,通过将外部数据和LLM生成语言技能集合,对LLM的输出进行优化,使输出更准确、…...

黑马点评前端Nginx启动失败问题解决记录

Nginx启动失败问题解决记录 问题描述 在学习黑马Redis课程时,启动黑马点评Nginx前端项目发现: 无法访问8080端口检查Windows端口占用情况(无占用)结论:Nginx服务未成功启动 错误日志分析 在nginx安装目录下的logs…...

第12天-Python+Qt5开发实战:10大经典案例与深度解析

1. 基础窗口与信号槽机制 python 复制 下载 import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButtonclass MainWindow(QMainWindow):def __init__(self):super().__init__()self.setWindowTitle("信号槽示例")btn = QPushButton("…...

软件开发命名避开保留关键字指南

在软件开发中,命名时避开保留关键字至关重要,否则可能导致语法错误、逻辑混乱或兼容性问题。以下是需要注意事项及具体建议: 1. 识别保留关键字 数据库系统:不同数据库的保留关键字不同,需查阅官方文档。 MySQL&#x…...

力扣第450场周赛

Q1. 数位和等于下标的最小下标 给你一个整数数组 nums 。 返回满足 nums[i] 的数位和(每一位数字相加求和)等于 i 的 最小 下标 i 。 如果不存在满足要求的下标,返回 -1 。 示例 1: 输入:nums [1,3,2] 输出&#xff1…...

React-改变当前页class默认的样式

比如antd for mobile&#xff0c;已经定义了默认的ui的class样式&#xff0c;如果想在当前页面的控件显示特殊的样式&#xff0c;除了指定style外&#xff0c;还可以强制改变默认class的样式&#xff0c;比如我想改变list.item的字体。 在返回渲染布局里面加上 return (<&…...

zabbix 常见问题

一、zabbix主动模式和被动模式可以同时使用吗&#xff1f; Zabbix 的主动模式&#xff08;Active Mode&#xff09;和被动模式&#xff08;Passive Mode&#xff09;可以同时启用并共存&#xff0c;但需要满足以下条件&#xff1a; 1、agent配置 在 Zabbix Agent 的配置文件…...

人工智能培训:解锁未来职场竞争力的核心路径与课程内容解析

当AI绘画工具在几秒内生成一幅媲美专业画师的作品&#xff0c;当AI程序员自主优化代码逻辑&#xff0c;当AI客服精准解答复杂问题——一个现实愈发清晰&#xff1a;人工智能正在重新定义“专业能力”的边界。 对于普通人而言&#xff0c;这场变革既带来焦虑&#xff0c;也孕育机…...

深入解析Java泛型:从定义到实战应用

目录 &#x1f680;前言&#x1f914;泛型的定义&#x1f427;泛型类&#x1f31f;泛型接口✍️泛型方法、通配符、上下限&#x1f4af;泛型方法&#x1f4af; 通配符与上下限⚙️通配符&#xff08;Wildcard&#xff09;⚙️泛型上下限⚙️应用场景 &#x1f99c;泛型支持的类…...

【开源】一个基于 Vue3 和 Electron 开发的第三方网易云音乐客户端,具有与官方客户端相似的界面布局

&#x1f3b5; XCMusic&#xff1a;高颜值第三方网易云音乐客户端 &#x1f3b6; &#x1f4cd; 项目亮点 XCMusic 是一款基于Vue3Electron开发的开源、跨平台网易云音乐客户端。 此音乐播放器基于 Electron 开发&#xff0c;旨在为用户提供简洁、美观、兼容多平台的音乐体验。…...

【云实验】Excel文件转存到RDS数据库

实验名称&#xff1a;Excel文件转存到RDS数据库 说明&#xff1a;把Excel的数据通过数据管理服务DMS&#xff08;Data Management Service&#xff09;导入到RDS MySQL数据库中。 流程&#xff1a;创建一个RDS for MySQL的实例&#xff0c;再创建数据库和账号&#xff0c;通过D…...

从零开始:用Python语言基础构建宠物养成游戏:从核心知识到完整实战

一、代码分段拆解与知识点映射 1. 初始化游戏数据&#xff1a;变量与数据类型的综合应用 # 用字典存储宠物信息&#xff08;嵌套字典数字/字符串类型&#xff09; pet {"name": "小雪", # 字符串&#xff1a;宠物名字"age": 1, …...

labview设计一个虚拟信号发生器

目标&#xff1a;设计一个虚拟信号发生器&#xff0c;通过功能键的设置可以产生正弦波、三角波、方波和锯齿波&#xff0c;并可以通过输入控件设置采集信号的频率、幅值、相位等参数。 一、正弦波 &#xff08;1&#xff09;创建一个枚举 &#xff08;2&#xff09;点击属性后…...

工业路由器WiFi6+5G的作用与使用指南,和普通路由器对比

工业路由器的技术优势 在现代工业环境中&#xff0c;网络连接的可靠性与效率直接影响生产效率和数据处理能力。WiFi 6&#xff08;即802.11ax&#xff09;和5G技术的结合&#xff0c;为工业路由器注入了强大的性能&#xff0c;使其成为智能制造、物联网和边缘计算的理想选择。…...

Chrome 插件网络请求的全面指南

在 Chrome 插件开发中&#xff0c;网络请求可以在多个上下文中实现&#xff0c;而不仅限于 background.js 和 content.js。以下是完整的网络请求实现方案&#xff1a; 一、主要请求实现位置 1. Background Script (后台脚本) 特点&#xff1a; 生命周期最长适合处理敏感数据…...

编译Qt5.15.16并启用pdf模块

编译Qt5.15.16并启用pdf模块 标题1.目录设置 -q-bulid –qt-everywhere-src-5.15.16 –bulid cd bulid 必须&#xff0c;否则会提示Project ERROR: You cannot configure qt separately within a top-level build. create .qmake.stash and .qmake.super in build folder …...

Python绘制新冠疫情的知识图谱

from pyvis.network import Network import networkx as nx import pandas as pd import os# 修复模板路径 from pyvis import network as net_moduleos.environ["PATH"] os.pathsep os.path.dirname(net_module.__file__)# 创建紧密连接图 g nx.Graph()# 关键修…...

canvas(三)-动画3d

在 <canvas> 中实现 3D 动画通常需要借助 WebGL 技术&#xff0c;因为原生的 2D 上下文&#xff08;CanvasRenderingContext2D&#xff09;无法直接支持 3D 渲染。WebGL 是基于 OpenGL ES 2.0 的 JavaScript API&#xff0c;可以直接在浏览器中实现高性能的 3D 图形渲染。…...

使用RUST在Arduino上进行编程(MacOS,mega板)

近年来&#xff0c;RUST成为了嵌入式编程的热门语言&#xff0c;本文通过实现&#xff08;1&#xff09;LED闪灯&#xff0c;以及&#xff08;2&#xff09;在console&#xff08;终端&#xff09;实现“Hello Rust World”两项功能来完成实操的入门。 深入学习可以参考RUST语言…...

MySQL迁移SSL报错

文章记录了之前tdsql迁移IDC过程中遇到的小问题 环境 xboss业务&#xff1a; tdsql未启用SSL&#xff0c; IDC-mysql启用了SSL: 原因分析 1&#xff0c; 迁移前&#xff1a; 因为tdsql未启用ssl&#xff0c; 且应用未显式配置ssl JDBC默认使用非SSL连接&#xff0c;因此可以正…...