When we interview, we are often asked questions like: What are the common business scenarios for Redis? What is cache penetration? How to solve it? What is cache avalanche? How to solve it? In the process of job hunting, the mastery of Redis technical knowledge has become a necessary skill. Redis-related questions have always been a question often asked in interviews of large factories, which has been the obstacle for many interviewees. They do not know where to start. Today, some redis-related interview questions of large factories are analyzed with examples. And share some knowledge points sorted out by Redis related issues.
Questions related to ali’s interview with Redis
1. What are Redis transactions? How does it work?
A transaction in Redis is a collection of commands, the smallest unit of execution in Redis. A transaction either executes at all or not at all. Reids transactions ensure that commands within a transaction are executed sequentially without being inserted by other commands. Redis transactions work by sending commands that belong to a transaction to Redis and then executing those commands in turn.
2. What are the common commands of Redis?
3. What is cache penetration? How to solve it?
Transparency refers to searching for data that does not exist in the cache and needs to be retrieved from the database. If the database cannot find the result, it will not be synchronized to the cache. As a result, the non-existent data will be queried to the database every time it is requested, losing the significance of the cache. There are two solutions: 1. Bloom filter stores all query parameters in a bitmap. Before querying the cache, find another bitmap for verification. If the bitmap exists, the data is queried by the underlying cache. If no query parameter is present in the bitmap, it is intercepted and the cached data is not queried. Scope of application: it can be used to realize data dictionary, judge weight of data, or set intersection 2. If the query returns null data, the null result is still cached. If the same key is used to obtain data again, the cache can directly return a null value even if the data does not exist, avoiding repeated access to the DB. There are two disadvantages to caching empty objects: the cache layer will store more key-value pairs, which can waste a lot of memory space if it is a malicious random access. This deficiency can be controlled by setting a very short expiration time for such data. The DB is inconsistent with the cache data. This notification, which can be considered for data updates via asynchronous messages, reduces such inconsistencies somewhat.
4. How to find Redis blocking exceptions?
Detection by Application Service Monitoring When Redis is blocked, online application services should detect it. For example, the Redis link times out. This requires the application service to increase the statistics for exceptions, and for redis-related exceptions, alarm. 2. Find the blocking problem through Redis monitoring system, and send an alarm when the monitoring system finds that there are anomalies in each monitoring indicator. Indicators include CPU, memory, and disk, slow query, and command time increases.
5. What are the differences between Redis persistence mechanism AOF and RDB?
The difference between RDB persistence and RDB persistence is that the snapshot of the data set in memory is written to the disk at a specified interval. The actual operation process is fork, and the data set is written to a temporary file first. After the data is written to a temporary file, the original file is replaced and stored in binary compression.
AOF persistence records every write and delete operation processed by the server in the form of logs. The query operation is not recorded in the form of text. You can open the file to see detailed operation records.
Why does Redis need to put all data in memory?
- Is Redis single threaded?
- Why is Redis designed to be single-threaded?
- What is cache avalanche? How to solve it?
- How many cache update strategies are there?
- What are the points to pay attention to?
- Please describe several possible causes of Redis blocking
- What are the Redis cluster architecture patterns?
- What is the maximum number of nodes in Redis cluster?
- What is the master-slave replication model for Redis clusters?
- Please introduce the Redis cluster implementation scheme
- Will there be write losses in the Redis cluster? Why is that?
- What is Redis slow query? Through what configuration?
Just show part of the Redis related to the face test set, part of the analysis, more Redis interview analysis can see the Redis in-depth notes: core principles and application practice, there is a need for friends at the end of the way to receive!
My Redis study notes
For Redis blind learning is a waste of time and worry, there is a Redis learning roadmap (Xmind source file notes) there are notes for each knowledge point sorted out! Today, through my Redis learning route, Xmind gives you some core knowledge points that you need to master to analyze Redis.
Need the whole Redis learning map and core knowledge of friends have access to the end of the article!The data structure
- Five data structure types
- HyperLogLog
- Redis command complete
Redis expiration strategy and memory obsolescence strategy
Redis Cluster
- Why cluster
- The data distribution
- Basic concepts of Redis Cluster
Redis persistence
- RDB (Redis DataBase)
- AOF (Append Only File)
- How do I choose a persistence scheme
- Fork: the CPU is blocked
- AOF appending blocking: blocking the hard disk
Redis study notes and study videos
# Finally: As technicians, what we fear most is to be content with the status quo and stay in the same place all the time. Then you may face your own career crisis at the age of 30, because you have worked so long to improve only your own age, and your skills remain unchanged for thousands of years!
I know that outsourcing is not an option for those who have no advantage in education, but it depends on how you move forward. Everyone has their own choice, if you like stability, then routine is for you, but you have an idea, do not tolerate mediocrity, then don’t let outsourcing bury you.
If you want to break through and achieve your dreams in the future, maybe you need to read this material, hopefully it will help you in your career development.
Finally, I hope I can develop smoothly in the future and win P7 as soon as possible! Similarly, I wish you to realize your ideal of life, and I hope we are all better and better.
How to get information: JAVA Architecture Crash Notes