当前位置:网站首页>Redis (VIII) - enterprise level solution (I)
Redis (VIII) - enterprise level solution (I)
2022-06-30 18:03:00 【Zhaoliwen is a pig】
Redis( 8、 ... and )—— Enterprise solutions ( One )
List of articles
1、 Cache preheating
Troubleshoot problems
- The number of requests is high
- The data throughput between master and slave is large , The operation frequency of data synchronization is high
Solution
- Preparatory work :
- Daily routine statistical data access records , Statistics of hot data with high access frequency
- utilize LRU Data deletion strategy , Building a data retention queue for example :storm And kafka coordination
- preparation :
- Classify the data in the statistical results , According to the level ,redis Load high-level hot data first
- Using distributed multi server to read data at the same time , Speed up the data loading process
- Hot data master and slave warm up at the same time
- The implementation of :
- Use script program to fix trigger data warm-up process
- If conditions permit , Used CDN( Content distribution network ), It works better
summary
Cache warm-up is before the system starts , Load the relevant cache data directly into the cache system in advance . Avoid when the user requests , Query database first , And then cache the data ! Users directly query the pre heated cache data !
2、 Cache avalanche
Database server crash (1)
- During the smooth operation of the system , All of a sudden, the number of database connections surged
- The application server cannot process the request in time
- A lot of 408,500 The error page appears
- Customers repeatedly refresh the page to get data
- Database crash
- The application server crashed
- It is invalid to restart the application server
- Redis Server crash
- Redis Cluster crash
- After restarting the database, it is put down by the instantaneous traffic again
Troubleshoot problems
- In a Shorter In time , More in the cache key Concentration expired
- Request access to expired data during this cycle ,redis Not hit ,redis Getting data from a database
- The database receives a large number of requests at the same time and cannot process them in time
- Redis There's a huge backlog of requests , It's starting to time out
- Database traffic surges , Database crash
- There is no data available in the cache after restart
- Redis Server resources are heavily occupied ,Redis Server crash
- Redis The cluster is collapsing , Cluster collapse
- The application server can't get the data in time to respond to the request , There are more and more requests from clients , The application server crashed
- application server ,redis, Restart all databases , The effect is not ideal
Problem analysis
- In a short period of time
- A lot of key Concentration expired
Solution ( Avenue )
- More static page processing
- structure Multi level cache architecture Nginx cache +redis cache +ehcache cache
- testing Mysql Serious time-consuming business optimization Check the bottleneck of the database : For example, timeout query 、 Time consuming, high transaction, etc
- Disaster warning mechanism monitor redis Server performance metrics
- CPU Occupy 、CPU Usage rate
- Memory capacity
- Average query response time
- Number of threads
- Current limiting 、 Downgrade Sacrifice some customer experience in a short period of time , Restrict access to some requests , Reduce application server pressure , After the business is running at a low speed, the access will be gradually released
Solution ( Technique )
- LRU And LFU Switch
- Data validity policy adjustment
- According to the validity period of business data Classified peak staggering ,A class 90 minute ,B class 80 minute ,C class 70 minute
- The expiration time is fixed time + The form of random values , Dilution Centralized due key The number of
- Hyperthermia Data usage is permanent key
- Regular maintenance ( Automatically + artificial ) Do traffic analysis for data that is about to expire , Confirm whether there is a delay , With the visit statistics , Delay of hot data
- Lock Use with caution !
summary
The cache avalanche is The amount of data that expired in a moment is too large , Causing pressure on the database server . If you can Effectively avoid expiration time concentration , It can effectively solve the emergence of avalanche phenomenon ( about 40%), Use with other strategies , And monitor the running data of the server , Make quick adjustment according to the operation record .
[
](
边栏推荐
- 6 张图带你搞懂 TCP 为什么是三次握手?
- 流批一体在京东的探索与实践
- 6 張圖帶你搞懂 TCP 為什麼是三次握手?
- 送受伤婴儿紧急就医,滴滴司机连闯五个红灯
- Develop those things: how to add text watermarks to videos?
- ABAP-发布Restful服务
- Taishan Office Technology Lecture: how to align and draw words of different sizes on the same line
- Exch: database integrity checking
- Add code block in word (Reprint)
- Apache 解析漏洞(CVE-2017-15715)_漏洞复现
猜你喜欢

Splitting. JS text title slow loading JS effect

编写C语言的最简单小程序Hello world

Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.

Shortcut keys for the rainbow brackets plug-in

Daily question brushing record (IX)

Importing alicloud ECS locally to solve deployment problems

. Net ORM framework hisql practice - Chapter 1 - integrating hisql

TFTP下载kernel,nfs挂载文件系统

如何写一个技术方案

生成对抗网络,从DCGAN到StyleGAN、pixel2pixel,人脸生成和图像翻译。
随机推荐
【架构】1366- 如何画出一张优秀的架构图
墨天轮沙龙 | 清华乔嘉林:Apache IoTDB,源于清华,建设开源生态之路
Apache parsing vulnerability (cve-2017-15715)_ Vulnerability recurrence
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
Advanced Mathematics (Seventh Edition) Tongji University General exercises one person solution
现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
小程序容器与物联网结合的方式
Parker Parker sensor p8s-grflx
构建基本buildroot文件系统
canvas鼠标控制重力js特效
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
后渗透之文件系统+上传下载文件
Small Tools(3) 集成Knife4j3.0.3接口文档
【剑指Offer】剑指 Offer 53 - II. 0~n-1中缺失的数字
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
港科大&MSRA新研究:关于图像到图像转换,Finetuning is all you need
How to write a technical proposal
大文件处理(上传,下载)思考
Canvas mouse control gravity JS effect
[零基础学IoT Pwn] 环境搭建