当前位置:网站首页>Common interview questions of redis factory
Common interview questions of redis factory
2022-07-05 22:01:00 【The sea of waves】
Redis Common interview questions in large factories
Redis Application scenarios of
- buffer
- Ranking List
- Counter
- Distributed session
- Distributed lock
- Social networks
- Latest list
- The messaging system
See in detail Redis Of 8 Big application scenarios
Redis Consistency between buffer and database
Some time , Multiple system instances update a key. Can be based on Zookeeper Implement distributed locks . Each system passes Zookeeper Acquire distributed lock , Ensure the same time , Only one system instance can operate on one Key, No one else is allowed to read or write .
Data you want to write to the cache , from MySQL It was found in the , You have to write MySQL in , write in MySQL A time stamp must be saved in , from MySQL When we find out , Time stamps are also found .
Every time before you write , Let's first judge the current one Value Is the timestamp of the Value The time stamp of should be new . If so , Then you can write , otherwise , You can't overwrite new data with old data .
See in detail Redis, Double write consistency 、 Concurrent competition 、 Threading model
Redis Distributed lock and its principle
It is realized by the following four commands :
- setnx
- getset
- expire
- del
See in detail redis Principle and implementation of distributed lock
Redis Solve client session Share Information ?
in consideration of session Medium data similar map Structure , use redis in hash Storage session The data is appropriate , If you use a single value Storage session data , Without a lock , There will be session The problem of coverage , Therefore use hash Storage session, Save only this change at a time session Attribute data , Lock handling is avoided , Better performance .
If I change each one session Property to trigger the store , There is a lot of change session Property will be triggered multiple times redis Write operations , There is also an impact on performance , We are at the end of each request , Do it once session Writing , And it writes the changed property .
If you didn't do it this time session Change of , I can't do it redis Written in , Only if there is no change session Exceeding a time threshold ( Constant change session Refreshes the threshold for the expiration time ), It will trigger session preservation , In order to session Can extend the validity period .
See in detail In a few minutes redis Storage session share —— Design implementation
Redis What problems do distributed locks solve ?
1.1 Locks need to be unique
1.2 The lock needs to have a timeout , Prevent deadlock
1.3 Lock creation and lock timeout setting need to be atomic
1.4 Lock timeout problem
1.5 Reentrant problem of lock
1.6 The problem of distributed locks under clusters
See in detail Redis Problems and solutions faced by distributed locks
Redis Why can distributed locks be supported ? How to use it ?
Redis Single process single thread mode , Using queue mode to change concurrent access into serial access , And multi client pairs Redis There's no competition for the connection .
See in detail Why? redis Can do distributed lock
Redis Of Buffer avalanche , Buffer penetration , Buffer breakdown , And Solutions



See in detail Cache avalanche 、 breakdown 、 through ( With answers )
Redis Persistence mechanism of , Elimination strategy
Redis Master slave copy
Redis Sentinel mechanism
The three questions above , See in detail Redis, sentry 、 Persistence 、 Master-slave 、 Tear your hands LRU, I've got it all sorted out
Zset Underlying data structure , as well as ziplist and skiplist
zset The underlying storage structure includes ziplist or skiplist, Use when both of the following conditions are met ziplist, Other times skiplist, The two conditions are as follows :
- The ordered set holds less elements than 128 individual
- The length of all elements saved in an ordered set is less than 64 byte
When ziplist As zset The underlying storage structure of , Each collection element uses two packed list nodes next to each other to hold , The first node holds the members of the element , The second element holds the score of the element .
When skiplist As zset The underlying storage structure , Use skiplist Save elements and scores in order , Use dict To save the mapping relationship between elements and scores .
See in detail redis zset Underlying data structure
边栏推荐
- How to organize an actual attack and defense drill
- MMAP learning
- HYSBZ 2243 染色 (树链拆分)
- 2.2 basic grammar of R language
- EL与JSTL注意事项汇总
- SecureCRT使用提示
- Recovery technology with checkpoints
- Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
- MMAP学习
- Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
猜你喜欢

Reptile practice

Efficiency difference between row first and column first traversal of mat data types in opencv

Performance monitoring of database tuning solutions

华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010

Overview of database recovery

The real situation of programmers

怎么利用Tensorflow2进行猫狗分类识别

Emotional analysis of wechat chat records on Valentine's day based on Text Mining

Concurrency control of performance tuning methodology

Bitbucket installation configuration
随机推荐
Matlab | app designer · I used Matlab to make a real-time editor of latex formula
Web3为互联网带来了哪些改变?
Summary of concurrency control
Detailed explanation of memset() function usage
The solution to the problem that Oracle hugepages are not used, causing the server to be too laggy
oracle 控制文件的多路复用
R language learning notes
Recovery technology with checkpoints
Cross end solutions to improve development efficiency
How to add new fields to mongodb with code (all)
Image editor for their AutoLayout environment
Codeforces 12D ball tree array simulation 3 sorting elements
Talking about MySQL index
Official clarification statement of Jihu company
HYSBZ 2243 染色 (树链拆分)
Daily question brushing record (XIV)
A long's perception
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
Robot framework setting variables
Summarize the reasons for 2XX, 3xx, 4xx, 5xx status codes