当前位置:网站首页>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
边栏推荐
- Regular expressions and re Libraries
- Efficiency difference between row first and column first traversal of mat data types in opencv
- Overview of concurrency control
- Scenario interview: ten questions and ten answers about distributed locks
- matlab绘制hsv色轮图
- crm创建基于fetch自己的自定义报告
- 微服務鏈路風險分析
- 从零开始实现lmax-Disruptor队列(四)多线程生产者MultiProducerSequencer原理解析
- Livelocks and deadlocks of concurrency control
- 他们主动布局(autolayout)环境的图像编辑器
猜你喜欢

Shell script, awk condition judgment and logic comparison &||

How to use tensorflow2 for cat and dog classification and recognition

database mirroring

Database tuning solution

Drawing HSV color wheel with MATLAB

Shell script, awk uses if, for process control

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

Interprocess communication in the "Chris Richardson microservice series" microservice architecture

PyGame practical project: write Snake games with 300 lines of code

Exercise 1 simple training of R language drawing
随机推荐
The American Championship is about to start. Are you ready?
Kingbasees v8r3 cluster maintenance case -- online addition of standby database management node
Codeforces 12D ball tree array simulation 3 sorting elements
总结出现2xx、3xx、4xx、5xx状态码的原因
装饰器学习01
Robot operation mechanism
如何向mongoDB中添加新的字段附代码(全)
How to view Apache log4j 2 remote code execution vulnerability?
QML reported an error expected token ";", expected a qualified name ID
R language learning notes
Scenario interview: ten questions and ten answers about distributed locks
Analyse des risques liés aux liaisons de microservices
DBeaver同时执行多条insert into报错处理
EBS Oracle 11g 克隆步骤(单节点)
Reptile practice
MMAP learning
poj 3237 Tree(樹鏈拆分)
Two stage locking protocol for concurrency control
Huawei fast game failed to call the login interface, and returned error code -1
每日刷题记录 (十四)