当前位置:网站首页>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 .
边栏推荐
- Hands on deep learning (IV) -- convolutional neural network CNN
- Cnopendata list data of Chinese colleges and Universities
- Numbers that appear only once
- [2022 actf] Web Topic recurrence
- QT learning 28 toolbar in the main window
- C语言二叉树与建堆
- buuctf misc USB
- 2022 welder (elementary) judgment questions and online simulation examination
- [UVM foundation] what is transaction
- Ansible
猜你喜欢
【经验分享】如何为visio扩展云服务图标
You Li takes you to talk about C language 6 (common keywords)
Codeforces Global Round 19
图解GPT3的工作原理
Linux server development, SQL statements, indexes, views, stored procedures, triggers
nacos
[CV] Wu Enda machine learning course notes | Chapter 8
【斯坦福计网CS144项目】Lab3: TCPSender
[unity] several ideas about circular motion of objects
Leetcode 40: combined sum II
随机推荐
After the interview, the interviewer roast in the circle of friends
leanote私有云笔记搭建
2022 tea master (intermediate) examination questions and mock examination
2022年茶艺师(中级)考试试题及模拟考试
Common validation comments
Hands on deep learning (IV) -- convolutional neural network CNN
Sign up now | oar hacker marathon phase III, waiting for your challenge
3D reconstruction - stereo correction
微信小程序基本组件使用介绍
【Unity】物体做圆周运动的几个思路
Qt学习26 布局管理综合实例
[UVM basics] summary of important knowledge points of "UVM practice" (continuous update...)
dash plotly
Is the test cycle compressed? Teach you 9 ways to deal with it
2022-07-06: will the following go language codes be panic? A: Meeting; B: No. package main import “C“ func main() { var ch chan struct
SQL优化的魅力!从 30248s 到 0.001s
[Stanford Jiwang cs144 project] lab4: tcpconnection
Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
《动手学深度学习》(四) -- 卷积神经网络 CNN
2022-07-06:以下go语言代码是否会panic?A:会;B:不会。 package main import “C“ func main() { var ch chan struct