First redis Interview questions : The answer follows

* redis What's the difference with other caching technologies
* redis What are the data structures
* What are the application scenarios
* redis Is thread safe
* redis Why is single thread so high
* redis How to store objects json , Binary How to choose ?
* redis Is there a transaction mechanism in , Does the transaction support rollback ( pit I won't support it )
* redis Is there a publish subscribe mode
* redis How to keep data consistency with database
* redis Is data lost due to downtime
* redis Data persistence mechanism
* rdb and aof The difference between
* Difference between incremental synchronization and full synchronization
* redis How to solve network delay in master slave replication
* redis Cleft brain
* redis Sentry mechanism How to achieve high availability
* redis Cluster solution colony Master slave sentry
* redis What if the master-slave synchronization efficiency is slow
* redis Cluster The whole realization principle of cluster
* redis Cache penetration breakdown avalanche Solution
* redis How to implement distributed lock
* key Expiration time of
* redis How to solve the problem when the memory is full Data discarding mechanism
* Bloon filter Cuckoo filter
redis Application scenarios
1 Second kill mechanism Sign in token storage token replace session because session Clustering is not supported SMS verification code is stored in redis in Reduce the pressure of database access
Hot data in redis For example, the home page hotspot key preheat redis Counter redis It's single threaded
redis Distributed lock setnx Using frames
wait
Highlights :
redis Time monitoring Monitoring callbacks that are about to expire

2 redis Is thread safe
security !!!!!! redis It's single threaded
3 Why is single thread efficient 1 Cache based 2 IO Multiplexing 3 redis The official website does not support it Windows system
4 Windows No, eollp Implementation of the model
5 transaction management Depending on version number mechanism multi and watch
6 redis Transaction does not support row locks
7 Transaction does not support rollback Support transaction cancellation
8 redis Is there a publish subscribe
Yes But rarely
9 The order was cancelled after 30 minutes Message timeout callback method
10 redis The consistency problem with database
1 empty redis Reread database
2 Incremental binlog Log synchronization scheme Introducing message middleware Subscription database binlog file ,redis

11 redis How to deal with full memory Data elimination strategy
(1)volatile-lru: Select the least recently used data cull from a dataset with an expiration time set .
(2)volatile-ttl: Select the data that will be expired from the dataset with the expiration time set .
(3)volatile-random: Choose data obsolescence arbitrarily from the dataset with expiration time set .
(4)volatile-lfu: Select the least frequently used data set for obsolescence from the dataset with set expiration time . (5)allkeys-lru: Culling the least recently used data from the dataset
(6)allkeys-lfu: Selecting the least frequently used data from the data set for obsolescence .
(7)allkeys-random: From dataset (server.db[i].dict) Data elimination at random in (8)
no-enviction( expel ): Prohibition of expulsion data , This is also the default policy . When there is not enough memory to hold new data ,
An error is reported for a new write operation , The request can proceed , Online tasks can't be sustained either , use no-enviction Policy can ensure that data is not lost .
12 redis Will data be lost after downtime
can't Persistence strategy aof perhaps rdb Loss of up to one second of data
13 redis Persistence strategy
rdb Total persistence Timing is efficient, but data loss is possible Low efficiency buffer
aop It's incremental persistence Incremental operation take set Operations recorded in log operations Loss of up to one second of data efficient But it is easy to lose data
14 redis How to solve network delay in master slave replication
Normally redis The master and slave are basically in the intranet , So the network delay is generally small Of course, there is still network delay information in the intranet, so we can only improve the bandwidth as a solution
15 Incremental synchronization and full synchronization
Incremental synchronization is to change data every time Will synchronize new content
Full synchronization is to synchronize all data every time
16 redis How to solve the problem of slow synchronization efficiency
slow Normal condition Use multi master and multi slave or tree form to achieve the requirements
17 Sentinel mode
When the primary node is down The sentinel chooses a slave node as the master node Sentinels also need to be clustered for voting weight
However, the situation of cleft brain needs to be solved by some strategies The principle of publish and subscribe is applied
Advantages and disadvantages
shortcoming : Sentinels need more than one There can be only one master node Data may be redundant
advantage : Central nature and stable structure
18 Partitioned cluster
for example Three master nodes The data reported by each master node is different 16384 The slot position is evenly distributed to three stages
redis-cluse Cluster The biggest advantage Rapid expansion and reduction
19 Buffer breakdown Through avalanche
Breakdown and penetration are not one
Breakdown has data In high concurrency scenario Will appear key Instantaneous failure of A lot of requests break down the cache Direct request database It's like cutting a hole in the barrier
Penetration is no data Checked the cache and did not check the database again either High frequency query will cause database pressure to increase sharply
avalanche When the cache pressure is too high redis Then query the database Under high frequency Too much data pressure

Technology
©2019-2020 Toolsou All rights reserved,
Java Swing JList: List box components Accurate mobile phone number capture , Big data of operators The difference between memory overflow and memory leak , Causes and Solutions Website mobile phone number capture method stay Vue Use in Web Worker3 species Python data structure ,13 Creation methods , This is the conclusion , Great ! What's the difference in server prices ? Basic definition and use of function ‘ To be continued SQL Server Database Glossary Chrome OS, For programmers and Windows What does it mean ? Internet Marketing