In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "what are the Redis professional interview questions", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "what are the Redis professional interview questions" can help you solve your doubts? let's follow the editor's train of thought to learn new knowledge.
1. What is Redis?
A: Redis, whose full name is Remote Dictionary Server (remote data Service), is a high-performance key-value database based on memory.
2. The data type of Redis?
Answer: Redis supports five data types: string (string), hash (hash), list (list), set (collection) and zset (sorted set: ordered collection).
What is commonly used in our actual project is string,hash. If you are an advanced user of Redis, you also need to add the following data structures: HyperLogLog, Geo, Pub/Sub.
If you say you've played Redis Module, like BloomFilter,RedisSearch,Redis-ML, the interviewer's eyes start to shine.
3. What are the benefits of using Redis?
(1) it is fast, because the data is stored in memory, and the advantage similar to HashMap,HashMap is that the time complexity of search and operation is O (1).
(2) support rich data types, support string,list,set,Zset,hash, etc.
(3) transactions are supported, and all operations are atomic. the so-called atomicity means that changes to the data are either performed or not performed at all.
(4) rich features: can be used for caching, messages, set expiration time by key, and will be deleted automatically after expiration
4. What are the advantages of Redis over Memcached?
(1) all values of Memcached are simple strings, and redis, as its replacement, supports richer data types.
(2) Redis is much faster than Memcached.
(3) Redis can persist its data
5. What are the differences between Memcache and Redis?
(1) Storage method Memecache stores all the data in memory, and will hang up when the power is off, and the data cannot exceed the memory size. Some of the Redis is stored on the hard disk, which ensures the persistence of the data.
(2) data support type Memcache is relatively simple to support data types. Redis has complex data types.
(3) using the underlying model, the underlying implementation between them and the application protocol for communicating with the client are different. Redis directly builds its own VM mechanism, because the general system calls system functions, it will waste a certain amount of time to move and request.
6. Is Redis single process and single thread?
Answer: Redis is single-process and single-threaded. Redis uses queue technology to change concurrent access into serial access, which eliminates the overhead of traditional database serial control.
7. What is the maximum storage capacity of a string type value?
Answer: 512m
8. What is the persistence mechanism of Redis? Their respective advantages and disadvantages?
Redis provides two persistence mechanisms: RDB and AOF:
1) RDB (Redis DataBase) persistence method: all key-value pairs of redis database are recorded by dataset snapshot (semi-persistence mode), and the data is written to a temporary file at a certain point in time. After the persistence ends, the last persisted file is replaced with this temporary file to achieve data recovery.
Advantages:
1. There is only one file dump.rdb, which is convenient for persistence.
two。 Disaster tolerance is good, a file can be saved to a secure disk.
3. Performance maximization, the IO child process to complete the write operation, let the main process continue to process commands, so maximize. (using a single child process for persistence, the main process will not do any IO operations, ensuring the high performance of redis) 4. The startup efficiency is higher than that of AOF when the dataset is large.
Disadvantages:
1. Data security is low. (RDB is persisted at intervals. If redis fails during persistence, data loss will occur. So this method is more suitable when the data requirements are not stringent)
2) AOF (Append-only file) persistence method: means that all command line records are saved as aof files in the format of redis command request protocol (fully persistent storage).
Advantages:
1. Data security, aof persistence can configure the appendfsync attribute, there is always, every command operation is recorded in the aof file.
two。 By writing files in append mode, even if the server goes down, the data consistency problem can be solved through the redis-check-aof tool.
The rewrite mode of the 3.AOF mechanism. (before the AOF file is rewrite (commands will be merged and rewritten when the file is too large), you can delete some of the commands (such as misoperated flushall).
Disadvantages:
1.AOF files are larger and slower to recover than RDB files.
two。 When the dataset is large, it is less efficient to start than rdb.
9. Common performance problems and solutions of Redis:
(1) Master is best not to write memory snapshots. If Master writes memory snapshots, the save command dispatches the rdbSave function, which will block the work of the main thread. When the snapshot is relatively large, it will have a great impact on performance and will intermittently suspend the service.
(2) if the data is important, a Slave enables AOF to back up data, and the policy is set to synchronize once per second.
(3) for the speed of master-slave replication and the stability of connection, Master and Slave should be in the same local area network.
(4) try to avoid adding slave libraries to the stressed master libraries.
(5) Master-slave replication does not use graphic structure, but one-way linked list structure is more stable, that is, Master
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.