当前位置:网站首页>模块八作业
模块八作业
2022-06-11 19:31:00 【InfoQ】
- 不同任务的队列建不同的表,比如xx_q, yy_q等。这样可以减少每个消息表的大小,提高性能;减少不同消息之间的干扰,提高SQL执行速度。
- 表结构
CREATE TABLE `xx_q` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `status` tinyint(4) DEFAULT 0, `ps` int(11) DEFAULT 0, `ut` timestamp, `msg` json, PRIMARY KEY (`id`), KEY `ut` (`ps`,`status`)) - 工作原理:
- 锁定本次工作消息: update xx_q set ps=connection_id() , status=1 where ps = 0 and status=0 limit 1;
- 获取消息体: select id, msg from xx_q where ps = connection_id() and status=1;
- 进行 消息消费
- 删除消费完毕的消息 delete from xx_q where ps = connection_id() and status=1;
- 清理僵尸进程占据的消息:定时清除 会话id 已经不存在(异常退出)但status=1 且 僵尸时间超过30分钟的消息
边栏推荐
- leetcode:66. add one-tenth
- [signal denoising] signal denoising based on FFT and fir with matlab code
- 基于飞桨搭建的多模态学习工具包PaddleMM
- Raki's notes on reading paper: memory replace with data compression for continuous learning
- CMU 15 - 445 cours de base de données Leçon 5 version texte - Pool tampon
- Go语言入门(六)——循环语句
- SISO decoder for repetition (supplementary Chapter 4)
- LDPC 7 - simple example of decoding
- Qubicle notes: self set shortcut keys (attached with Lao Wang's self set shortcut key file)
- 2022 the latest software testing classic summarized by major manufacturers. After reading it, I'm not afraid I won't get an offer
猜你喜欢

【Multisim仿真】利用运算放大器产生方波、三角波发生器
![[image denoising] image denoising based on Markov random field with matlab code](/img/ef/d28b89a47723b43705fca07261c958.png)
[image denoising] image denoising based on Markov random field with matlab code

NR LDPC punched

干货丨MapReduce的工作流程是怎样的?

Practice of tag recognition based on Huawei cloud image

Activate function formulas, derivatives, image notes

Flutter--Button浅谈

何恺明团队的“视频版本MAE”,高效视频预训练!Mask Ratio高达90%时效果也很好!...

Tensorflow---TFRecord文件的创建与读取

Find the maximum 3 same digits in the string
随机推荐
Hospital intelligent infusion management system source code hospital source code
AHB2Standard_handshake_bridge 设计
PyMySQL利用游标操作数据库方法封装!!!
Questions and requirements of marketing course design in autumn 21 of Dagong [standard answer]
【Laravel系列7.5】事件系统
APB2standard_handshake_bridge 设计
Operator new and placement new
LDPC 7 - simple example of decoding
09 MySQL lock
【信号去噪】基于非线性滤波器实现语音自适应去噪附matlab代码
【图像去噪】基于绝对差分中值滤波、加权中值滤波法、改进加权中值滤波实现脉冲噪声图像去噪附matlab代码
CMU 15-445 database course lesson 5 text version - buffer pool
Lecture 30 linear algebra Lecture 2 Matrix
Find the maximum 3 same digits in the string
[signal denoising] speech adaptive denoising based on nonlinear filter with matlab code
Expandable type of system
Replace the backbone of target detection (take the fast RCNN as an example)
"Case sharing" based on am57x+ artix-7 FPGA development board - detailed explanation of Pru Development Manual
SLAM APP
[Multisim Simulation] using operational amplifier to generate sawtooth wave