当前位置:网站首页>Potential bottleneck of redis
Potential bottleneck of redis
2022-06-30 06:01:00 【Flower master】
Redis Single threaded processing IO Request performance bottlenecks
1、 Any request in server Once it happens, it takes time , Will affect the whole server Performance of , In other words, the subsequent requests have to wait for the previous time-consuming request to be processed , To be dealt with by oneself . Time consuming operations include the following :
a、 operation bigkey: Write a bigkey It takes more time to allocate memory , Again , Delete bigkey Freeing memory can also take time ;
b、 Using overly complex commands : for example SORT/SUNION/ZUNIONSTORE, perhaps O(N) command , however N It's big , for example lrange key 0 -1 Query the full amount of data at a time ;
c、 A lot of key Concentration expired :Redis The expiration mechanism is also executed in the main thread , A lot of key The expiration of a set can result in the processing of a request , Time consuming to delete expired key, It takes longer ;
d、 Elimination strategy : The elimination strategy is also executed in the main thread , When memory exceeds Redis After the memory limit , Each write needs to be eliminated key, It will also take longer ;
e、AOF The brush plate is on always Mechanism : Every time you write, you need to brush this operation to disk , Writing to disk is much slower than writing to memory , Will slow down Redis Performance of ;
f、 Master slave total synchronous generation RDB: Although fork Child processes generate data snapshots , but fork This moment will also block the whole thread , The larger the instance , The longer the blocking time ;
2、 When the amount of concurrency is very large , Single thread read-write client IO Data has performance bottlenecks , Although IO Multiplexing mechanism , But read and write client data is still synchronized IO, Only a single thread can read the client data in turn , Can't make use of CPU Multicore .
Aiming at problems 1, On the one hand, it needs business personnel to avoid , One side Redis stay 4.0 Launched lazy-free Mechanism , hold bigkey Time consuming operations to free memory are executed in asynchronous threads , Reduce the impact on the main thread .
Aiming at problems 2,Redis stay 6.0 Multithreading has been introduced , It can be used in high concurrency scenarios CPU Multi core multi thread read and write client data , Further improve server performance , Of course , Only the read and write to the client are parallel , The real operation of each command is still single threaded .
边栏推荐
- Learning automation ppt
- Switch to software testing and report to the training class for 3 months. It's a high paying job. Is it reliable?
- MySQL數據庫用戶管理
- Inno setup the simplest user-defined interface effect
- [regular expression series] greedy and non greedy patterns
- Idea of capturing mobile terminal variant combination
- Ultra simple STM32 RTC alarm clock configuration
- Sword finger offer 29 Print matrix clockwise
- 86. separate linked list
- 云服务器部署 Web 项目
猜你喜欢

Shenzhou ares tx6 boot logo modification tutorial

动态规划--怪盗基德的滑翔翼

Solidity - Security - reentrancy attack

English语法_形容词/副词3级-最高级

Beauty of Refactoring: when multithreaded batch processing task lifts the beam - Universal scaffold

I have been working as a software testing engineer for 5 years, but I was replaced by an intern. How can I improve myself?
![[road of system analyst] collection of wrong topics in Project Management Chapter](/img/8b/2908cd282f5e505efe5223b4c5ddbf.jpg)
[road of system analyst] collection of wrong topics in Project Management Chapter

MySQL transaction

SparseArray

重构之美:当多线程批处理任务挑起大梁 - 万能脚手架
随机推荐
Use of tornado template
English grammar_ Adjective / adverb Level 3 - superlative
At the beginning of 2022, people who are ready to change jobs should pay attention to
Today, Ali came out with 35K. It's really sandpaper that wiped my ass. it showed me my hand
UE4_ Editor UMG close window cannot destroy UMG immediately
How does WPS cancel automatic numbering? Four options
[Alibaba cloud] student growth plan answers
Leetcode56. consolidation interval
[chestnut sugar GIS] global mapper - how to assign the elevation value of the grid to the point
86. separate linked list
电脑查看WiFi使用密码
Promise knowledge points
Force deduction exercise -- deleting repeated items in ordered sequence 1.0
MySQL storage system
hashlips_ art_ Engine-1.0.6 usage
Sword finger offer 18 Delete the node of the linked list
1380. lucky numbers in matrices
MySQL advanced SQL statement
【LeetCode】236. Nearest common ancestor of binary tree
Codeforces Round #390 (Div. 2) D. Fedor and coupons