当前位置:网站首页>消息队列消息存储设计(架构实战营 模块八作业)
消息队列消息存储设计(架构实战营 模块八作业)
2022-07-31 22:37:00 【InfoQ】
消息表

消费信息表
consume_log 表
- 我们支持多个消费者组,每个消费者组共享一条消费进度记录,所以表中需要有 group 字段来区分是哪个消费者组的消费记录;
- 消费偏移量是最重要的,记录了消费到哪条数据,用 offset 来标识,即 message 表中的 msg_id,因为 msg_id 在一个数据分组,一个 topic 下是严格递增的;

索引分析
发送消息
- 客户端完成分片路由,分配到某个 shard,发送消息数据
- 消息队列服务器根据 topic 找到对应的消息表 message_{topic},然后插入数据,msg_id 自增
消费消息
- 客户端完成分片的路由,向对应服务器拉取消息,带上参数 topic,group
- 查询 consumer_log 表,根据 topic,group 通过索引找到对应的数据,取出 offset
- 根据 offset 查询对应的 message 表,通过主键 id,找出下个 offset 的记录,取出并准备返回
- 更新 consumer_log 的 offset 信息
- 返回数据
边栏推荐
- 网络安全--通过握手包破解WiFi(详细教程)
- Summary of the classic drawing method of histogram
- Implementing a Simple Framework for Managing Object Information Using Reflection
- [QNX Hypervisor 2.2 User Manual]9.14 set
- Document management and tools in the development process
- TestCafeSummary
- 21. Support Vector Machine - Introduction to Kernel Functions
- Douyin fetches video list based on keywords API
- Input and output optimization
- Unity - by casting and cloning method dynamic control under various UGUI create and display
猜你喜欢

Golang - from entry to abandonment

Chapter VII

flowable workflow all business concepts

UOS统信系统 - WindTerm使用

Pytest first experience

AI automatic code writing plugin Copilot (co-pilot)

Flex layout in detail

Bika LIMS open source LIMS set - use of SENAITE (detection process)

日常--Kali开启SSH(详细教程)
![[NLP] What is the memory of the model!](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[NLP] What is the memory of the model!
随机推荐
VOT2021 game introduction
数据分析(一)——matplotlib
#yyds干货盘点# 面试必刷TOP101:链表中环的入口结点
不知道该怎么办的同步问题
The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#
基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
(26)Blender源码分析之顶层菜单的关于菜单
SQL注入 Less47(报错注入) 和Less49(时间盲注)
C程序设计-方法与实践(清华大学出版社)习题解析
HTC使用官方固件作为底包制作rom卡刷包教程
高等代数_证明_任何矩阵都相似于一个上三角矩阵
Go mode tidy reports an error go warning “all” matched no packages
Bionic caterpillar robot source code
Implementing a Simple Framework for Managing Object Information Using Reflection
了解下C# 匿名方法
VOT2021比赛简介
PHP三元(三目)运算符
Shell常用脚本:Nexus批量上传本地仓库增强版脚本(强烈推荐)
"SDOI2016" Journey Problem Solution
"The core concept of" image classification and target detection in the positive and negative samples and understanding architecture