当前位置:网站首页>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 .
[
](
边栏推荐
- 现在玩期货需要注意什么,在哪里开户比较安全,我第一次接触
- Synchronized summary
- Apache parsing vulnerability (cve-2017-15715)_ Vulnerability recurrence
- . Net ORM framework hisql practice - Chapter 1 - integrating hisql
- Exch:修复丢失的系统邮箱
- New skill: accelerate node through code cache JS startup
- 流批一体在京东的探索与实践
- NFT铸造交易平台开发详情
- The gates of Europe
- Vue3 reactive database
猜你喜欢

【架构】1366- 如何画出一张优秀的架构图

如何写一个技术方案

Key to understanding the trend of spot Silver

Babbitt | yuanuniverse daily must read: minors ask for a refund after a reward. The virtual anchor says he is a big wrongdoer. How do you think of this regulatory loophole

分享 5 大常用的特征选择方法,机器学习入门必看!!!

IEEE TBD SCI impact factor increased to 4.271, ranking Q1!

后渗透之文件系统+上传下载文件

K-line diagram must be read for quick start

What will be the game changes brought about by the meta universe?

How to write a technical proposal
随机推荐
阿里云ECS导入本地,解决部署的问题
Analysis on the construction scheme and necessity of constructing expressway video monitoring platform
零基础也能做Apple大片!这款免费工具帮你渲染、做特效、丝滑展示
每日面试1题-如何防止CDN防护被绕过
Rainbow Brackets 插件的快捷键
Word中添加代码块(转载)
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
. Net ORM framework hisql practice - Chapter 1 - integrating hisql
NFT: 开启加密艺术时代的无限可能
腾讯云的一场硬仗
Tubes响应性数据系统的设计与原理
广电5G正式启航,黄金频段将如何应用引关注
TFTP download kernel, NFS mount file system
Advanced Mathematics (Seventh Edition) Tongji University General exercises one person solution
[Architecture] 1366- how to draw an excellent architecture diagram
Course design for the end of the semester: product sales management system based on SSM
4 years of working experience, and you can't tell the five communication modes between multithreads. Can you believe it?
Synchronized summary
Implementation of graduation project management system based on SSM
Taishan Office Technology Lecture: how to align and draw words of different sizes on the same line