当前位置:网站首页>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 .
边栏推荐
- CentOS7下安装PostgreSQL11数据库
- 微信小程序中的路由跳转
- Qt学习27 应用程序中的主窗口
- Pytest+allure+jenkins installation problem: pytest: error: unrecognized arguments: --alluredir
- 解决:Could NOT find KF5 (missing: CoreAddons DBusAddons DocTools XmlGui)
- 解决问题:Unable to connect to Redis
- [SUCTF 2019]Game
- Live online system source code, using valueanimator to achieve view zoom in and out animation effect
- Hands on deep learning (IV) -- convolutional neural network CNN
- [unity] several ideas about circular motion of objects
猜你喜欢

LeetCode 90:子集 II

知识点滴 - 关于苹果认证MFI
![[GUET-CTF2019]虚假的压缩包](/img/a2/7da2a789eb49fa0df256ab565d5f0e.png)
[GUET-CTF2019]虚假的压缩包
![[unity] several ideas about circular motion of objects](/img/84/e70c6696629dbe17ace011553f43ff.png)
[unity] several ideas about circular motion of objects

The configuration that needs to be modified when switching between high and low versions of MySQL 5-8 (take aicode as an example here)

2022 simulated examination question bank and online simulated examination of tea master (primary) examination questions

padavan手动安装php

Idea add class annotation template and method template

Codeforces Global Round 19
![[Stanford Jiwang cs144 project] lab4: tcpconnection](/img/fd/704d19287a12290f779cfc223c71c8.png)
[Stanford Jiwang cs144 project] lab4: tcpconnection
随机推荐
Most elements
QT learning 28 toolbar in the main window
Resource create package method
[P2P] local packet capturing
2022制冷与空调设备运行操作复训题库及答案
Pytest+allure+jenkins environment -- completion of pit filling
What are the positions of communication equipment manufacturers?
自定义类加载器加载网络Class
微信小程序基本组件使用介绍
[experience sharing] how to expand the cloud service icon for Visio
2022 recurrent training question bank and answers of refrigeration and air conditioning equipment operation
[SUCTF 2019]Game
Technology cloud report: from robot to Cobot, human-computer integration is creating an era
2022茶艺师(初级)考试题模拟考试题库及在线模拟考试
Mysql高低版本切换需要修改的配置5-8(此处以aicode为例)
Solve could not find or load the QT platform plugin "xcb" in "
Ansible
Explore Cassandra's decentralized distributed architecture
[UTCTF2020]file header
paddlepaddle 29 无模型定义代码下动态修改网络结构(relu变prelu,conv2d变conv3d,2d语义分割模型改为3d语义分割模型)