当前位置:网站首页>设计消息队列存储信息数据的MySQL表结构
设计消息队列存储信息数据的MySQL表结构
2022-06-12 23:37:00 【InfoQ】
要求
- 包括表名、字段、索引;
- 用文字描述设计思路和理由,例如:为什么设计某个索引?
- 需要考虑每个消息队列一张表,还是所有消息放一张表,里面加一个“队列名称”的字段
1.说明
1.1 消息队列使用的常用技术
- mysql (速度相对较慢,易实现,可靠)
- redis (速度快)
- 专业的消息系统 (专业,可靠,学习成本高)
1.2 常用队列的触发机制
- 写个循环一直读️
- 定时任务
- 守护进程
2.设计思路
- 每一种队列存一张表,这样比较好扩展,队列之间后续比较好做隔离,以前实际业务中,曾经存到一张表,靠队列类型,名称等字段做区分。有些队列忽然大的流量进来,导致整个消息队列全部都出问题。
- 队列写入数据表中,通过自增 id 来标识顺序,先入先出。实际业务中,也可加入队列消费优先级,高,中,低这种。在消费能力一般的情况下,优先消费优先级高的。这样不仅发挥了消息队列的作用,也更有灵活性。
- 保证高可用,采用主从的数据库架构。
- 引入错误日志表,消费状态表。用来存储,标记消费的记录。也方便队列重试。
- 和业务商量好队列完成后的消息清除时间,以保证数据表不会一直处于线性增长的状态。
3.数据表
消息队列表
错误日志表
消费状态表
边栏推荐
- The Milvus graphical management tool Attu is coming!
- Save state when viewpager is used with fragment fragmentpageradapter
- csredis-in-asp. Net core theory practice - use examples
- [opencv learning] perspective transformation matrix
- Novice must see! How rust beginners write gear smart contracts (1)
- Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation
- [kubernetes guide ④] pod quick start
- Lua loop statement
- InfoQ geek media's 15th anniversary solicitation | brief introduction to the four challenges of building a micro service architecture
- [SciPy optimization tutorial] v. quick solution of univariate function optimization
猜你喜欢

How to get Matplotlib figure size

Colab tutorial (super detailed version) and colab pro/colab pro+ usage evaluation

MYSQL 行转列、列转行、多列转一行、一行转多列
![[opencv learning] small ticket recognition based on perspective transformation and OCR recognition](/img/47/08b9dd9dbea9e9cb6deda975f4d652.jpg)
[opencv learning] small ticket recognition based on perspective transformation and OCR recognition
![[kubernetes guide ④] pod quick start](/img/ed/e016d2469ee29a387238dc3b5ebbd6.png)
[kubernetes guide ④] pod quick start

Deep learning neural network: implementation method of convolution [direct method (no loss of precision), GEMM (matrix multiplication, no loss of precision), FFT (Fourier transform, loss of precision)

Develop a web office suite from scratch (5): mouse hover over text

Heilongjiang Branch and Liaoning Branch of PostgreSQL Chinese community have been established!

dict和set的基本操作

iShot
随机推荐
InfoQ 极客传媒 15 周年庆征文|简述构建微服务架构的四大挑战
Alien Skin Exposure X7调色滤镜插件,RAW后期处理工具
Analysis report on business model innovation path and operation status of China's app store industry from 2022 to 2028
Introduction to message oriented middleware (message queue)
Abstract methods and abstract classes
Redis realizes SMS verification code login
2022年G3锅炉水处理考题模拟考试平台操作
PostgreSQL 中文社区黑龙江分会和辽宁分会成立啦!
2022年R2移动式压力容器充装考试题及在线模拟考试
The Milvus graphical management tool Attu is coming!
Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测
Embedded pipeline out of the box
2022年危險化學品經營單比特安全管理人員考試試題及在線模擬考試
Novice must see! How rust beginners write gear smart contracts (1)
OpenCV源代码编译
RT thread quick start - experience RT thread
Comprehensive analysis of C array
PHP删除二维数组中相同项的数据
Analysis report on the 14th five year development plan and operation mode of China's hazardous waste treatment industry from 2022 to 2028
Bit_ Binary number