当前位置:网站首页>Linux server development, MySQL cache strategy
Linux server development, MySQL cache strategy
2022-07-07 07:55:00 【Tuen Mun pheasant calls me chicken】
Recommend a free open course of zero sound College , Personally, I think the teacher spoke well , Share with you :Linux,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK, Streaming media ,CDN,P2P,K8S,Docker,TCP/IP, coroutines ,DPDK Etc , Learn now
MySql What are the ways to improve read and write performance ?
- Connection pool Blocking io+ Thread pool
- Asynchronous connection Non blocking io
- sql Execute punishment : Carry out in a timely manner + Precompile execution
- Read / write separation
- Cache scheme
Master-slave replication solves the problem of single point of failure .
Reading strategy
- First look at cache There's no data in it , There is a direct return .
- without , Go again MySql Take the data from the library .
- If MySql There are data in it. , The cache to cache
- without , That is, there is no
Final consistency and strong consistency .
Write strategy
- Delete first cache, And then delete MySql
- Delete first cache, Revise MySql. Modify cache directly after improvement , Set expiration time , modify MySql Remove the expiration time .
- Delete first cache, Add again MySql. Modify cache directly after improvement , Set expiration time , modify MySql Remove the expiration time .
Asynchronous operation is compared with synchronous operation , It mainly saves the time of network transmission .
Cache penetration
redis and MySql None of them exist ,redis No data will always be requested MySql, and MySql There is nothing but to return . When a large number of requests accumulate to MySql, Finally, I was overwhelmed .、
Solution :
- Find out MySql non-existent , take redis Set up <key,nil> Set expiration time , The next visit is not visit MySql, It is easy to cause many invalid redis Cache data .
- Set up the bloon filter , The non-existent hotspot data is directly filtered out .
Cache breakdown
redis No, ,MySql There's data . When there are a large number of concurrent requests , Request to pile up MySql Too big . One of them Key A lot of requests .
- Lock , Operate with lock , Sleep without lock .
- Will be a lot hot key Set not to expire .
Cache avalanche
redis Downtime , All data are empty , Cause collapse MySql. Multiple Key A lot of advice .
- Highly available cluster solutions , Like sentinel mode ,cluster Pattern .
- Set the random period value or other mechanism to stagger the expiration time .
- redis Turn on persistence .
边栏推荐
- Gslx680 touch screen driver source code analysis (gslx680. C)
- 解决:Could NOT find KF5 (missing: CoreAddons DBusAddons DocTools XmlGui)
- paddlepaddle 29 无模型定义代码下动态修改网络结构(relu变prelu,conv2d变conv3d,2d语义分割模型改为3d语义分割模型)
- [guess-ctf2019] fake compressed packets
- 【Unity】物体做圆周运动的几个思路
- PHP exports millions of data
- [P2P] local packet capturing
- Regular e-commerce problems part1
- [UVM basics] summary of important knowledge points of "UVM practice" (continuous update...)
- 探索Cassandra的去中心化分布式架构
猜你喜欢

Hands on deep learning (IV) -- convolutional neural network CNN

Detailed explanation of Kalman filter for motion state estimation
![[2022 ciscn] replay of preliminary web topics](/img/1c/4297379fccde28f76ebe04d085c5a4.png)
[2022 ciscn] replay of preliminary web topics

misc ez_ usb

通信设备商,到底有哪些岗位?

@component(““)
![[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替](/img/e3/cceede6babae3c8a24336c81d98aa7.jpg)
[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替

Linux server development, SQL statements, indexes, views, stored procedures, triggers

json 数据展平pd.json_normalize

nacos
随机推荐
[UVM practice] Chapter 1: configuring the UVM environment (taking VCs as an example), run through the examples in the book
Qt学习26 布局管理综合实例
[CV] Wu Enda machine learning course notes | Chapter 8
padavan手动安装php
pytorch 参数初始化
【VHDL 并行语句执行】
2022 welder (elementary) judgment questions and online simulation examination
vus. Precautions for SSR requesting data in asyndata function
3D reconstruction - stereo correction
C语言航班订票系统
2022制冷与空调设备运行操作复训题库及答案
[experience sharing] how to expand the cloud service icon for Visio
Idea add class annotation template and method template
Resource create package method
C语言通信行程卡后台系统
pytest+allure+jenkins环境--填坑完毕
Figure out the working principle of gpt3
Why should we understand the trend of spot gold?
[P2P] local packet capturing
Operation suggestions for today's spot Silver