当前位置:网站首页>设计消息队列存储信息数据的MySQL表结构
设计消息队列存储信息数据的MySQL表结构
2022-06-12 23:37:00 【InfoQ】
要求
- 包括表名、字段、索引;
- 用文字描述设计思路和理由,例如:为什么设计某个索引?
- 需要考虑每个消息队列一张表,还是所有消息放一张表,里面加一个“队列名称”的字段
1.说明
1.1 消息队列使用的常用技术
- mysql (速度相对较慢,易实现,可靠)
- redis (速度快)
- 专业的消息系统 (专业,可靠,学习成本高)
1.2 常用队列的触发机制
- 写个循环一直读️
- 定时任务
- 守护进程
2.设计思路
- 每一种队列存一张表,这样比较好扩展,队列之间后续比较好做隔离,以前实际业务中,曾经存到一张表,靠队列类型,名称等字段做区分。有些队列忽然大的流量进来,导致整个消息队列全部都出问题。
- 队列写入数据表中,通过自增 id 来标识顺序,先入先出。实际业务中,也可加入队列消费优先级,高,中,低这种。在消费能力一般的情况下,优先消费优先级高的。这样不仅发挥了消息队列的作用,也更有灵活性。
- 保证高可用,采用主从的数据库架构。
- 引入错误日志表,消费状态表。用来存储,标记消费的记录。也方便队列重试。
- 和业务商量好队列完成后的消息清除时间,以保证数据表不会一直处于线性增长的状态。
3.数据表
消息队列表
错误日志表
消费状态表
边栏推荐
- Detr (detection with transformers) learning notes
- 細數攻防演練中十大關鍵防守點
- Dry goods sharing | BitSet application details
- PostgreSQL 中文社区黑龙江分会和辽宁分会成立啦!
- ASP. Net core Middleware
- SAP QM qp03 displays an inspection plan with multiple specs inspection features
- [opencv learning] perspective transformation matrix
- 深度学习-神经网络:卷积的实现方法【直接法(精度没损失)、GEMM(矩阵乘法,精度没损失)、FFT(傅里叶变换,精度有损失)、Winograd(精度有损失)】
- Abstract methods and abstract classes
- 〖Kubernetes指南④〗Pod快速入门
猜你喜欢
Summary of MySQL foundation view
MYSQL 行转列、列转行、多列转一行、一行转多列
模型过拟合-解决方案(二):Dropout
2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
Industry reshuffle, a large number of programmers are going to lose their jobs? How can we break the current workplace dilemma
So, what is the difference between e.target and e.currenttarget?
For product managers, which of the two certificates, PMP and NPDP, is more authoritative?
应用最广泛的动态路由协议:OSPF
Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测
设计消息队列存储消息数据的 MySQL 表格
随机推荐
2202-簡曆制作
妙才周刊 - 5
Report on the "fourteenth five year plan" and strategic strategy recommendations for China's intellectual property protection industry 2022 ~ 2028
Zhengzhou University of light industry -- development and sharing of harmonyos pet health system
模型过拟合-解决方案(二):Dropout
应用最广泛的动态路由协议:OSPF
自动获取结构体内部成员变量的位置偏移
2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
China's new generation information technology industry "14th five year plan" special planning and innovation strategic direction report 2022 ~ 2028
Detr (detection with transformers) learning notes
Introduction to message oriented middleware (message queue)
Using baserecyclerviewadapterhelper to implement tree structure
[literature translation - Part] revealing the structure of clinical EEG signals by self supervised learning (SSL and RP principles / data / preprocessing)
测试平台系列(97) 完善执行case部分
MySQL基础篇视图的总结
Leetcode 2200. 找出数组中的所有 K 近邻下标(可以,一次过)
The development trend of digital collections!
細數攻防演練中十大關鍵防守點
PostgreSQL 中文社区黑龙江分会和辽宁分会成立啦!
启牛帮开通的股票账户是安全可信的吗?