当前位置:网站首页>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
边栏推荐
- Performance monitoring of database tuning solutions
- Two stage locking protocol for concurrency control
- 1.3 years of work experience, double non naked resignation agency face-to-face experience [already employed]
- 如何向mongoDB中添加新的字段附代码(全)
- C language knowledge points link
- Environment configuration problem record
- Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
- 资深电感厂家告诉你电感什么情况会有噪音电感噪音是比较常见的一种电感故障情况,如果使用的电感出现了噪音大家也不用着急,只需要准确查找分析出什么何原因,其实还是有具体的方法来解决的。作为一家拥有18年品牌
- Learning of mall permission module
- Daily question brushing record (XIV)
猜你喜欢
Type of fault
ICMP introduction
元宇宙中的三大“派系”
Official clarification statement of Jihu company
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
[Yugong series] go teaching course in July 2022 004 go code Notes
Learning of mall permission module
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
怎么利用Tensorflow2进行猫狗分类识别
Recovery technology with checkpoints
随机推荐
Blocking of concurrency control
Robot operation mechanism
POJ 3237 tree (tree chain splitting)
Environment configuration problem record
Lightweight dynamic monitorable thread pool based on configuration center - dynamictp
How to use tensorflow2 for cat and dog classification and recognition
A number of ventilator giants' products have been recalled recently, and the ventilator market is still in incremental competition
database mirroring
MMAP
K210学习笔记(四) K210同时运行多个模型
Learning of mall permission module
MATLAB | App Designer·我用MATLAB制作了一款LATEX公式实时编辑器
Business learning of mall commodity module
Net small and medium-sized enterprise project development framework series (one)
装饰器学习01
【愚公系列】2022年7月 Go教学课程 003-IDE的安装和基本使用
Advantages of robot framework
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Getting started with microservices (resttemplate, Eureka, Nacos, feign, gateway)
Poj3414广泛搜索