Lock screen interview questions 100 days, adhere to update the interview questions every working day. Lock screen interview questions APP and mini program are now online, official website address:https://www.demosoftware.cc/#…. It has included all the contents of the interview questions updated daily, as well as features such as unlocking screen review interview questions, daily programming questions email push, etc. This will give you a head start in the interview and give the interviewer a leg up! Here are today’s interview questions:

==== What are the features of Redis?

Redis is an in-memory cache database developed by Italian Salvatore Sanfilippo (online name: Antirez). The full name of Redis is: Remote Dictionary Server (Remote Data Service). The software is written in C language. It is a typical NoSQL database Server. String, list, set, zset(sorted), hash. Redis is essentially a key-value in-memory database, much like memcached. The entire database is loaded in memory and operated on, periodically flushing the database data asynchronously to disk for storage. Because it is a pure memory operation, Redis performs very well, handling over 100,000 reads and writes per second, making it the fastest key-value DB known. The best thing about Redis is not only its performance, but also its ability to store multiple data structures. The maximum limit for a single value is 1GB, unlike memcached, which can only store 1MB of data. In addition, Redis can also set expire time for the stored key-values. The main drawback of Redis is that the database capacity is limited by physical memory and cannot be used for high-performance reading and writing of massive data. Therefore, the scenarios suitable for Redis are mainly limited to high-performance operation and computation of small data volume.

==== Why does Redis need to put all the data in memory?

In order to achieve the fastest read and write speed, Redis reads data into memory and writes data to disk asynchronously. So Redis is fast and data persistent. If you don’t put data in memory, disk I/O speed is a serious impact on Redis performance. In today’s cheaper and cheaper memory, Redis will become more and more popular. If the maximum memory usage is set, new values cannot be inserted after the memory limit has been reached.

==== What are the common performance issues with Redis? How to solve it?

(1) When Master writes a memory snapshot, 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 the performance, and the service will be interrupted. Therefore, Master had better not write a memory snapshot. (2) Master AOF persistence. If the AOF file is not rewritten, this persistence method will have the least impact on performance, but the AOF file will continue to grow. If the AOF file is too large, the recovery speed of Master restarting will be affected. Master should not do any persistence work, including memory snapshot and AOF log file, especially do not enable memory snapshot for persistence, if the data is critical, a Slave to open AOF backup data, the policy is to synchronize once per second. (3) Master calls BGREWRITEAOF to rewrite the AOF file. AOF will occupy a large amount of CPU and memory resources during rewriting, resulting in excessive service load and temporary service suspension. (4) The performance of Redis master-slave replication. For the speed of master-slave replication and the stability of connection, it is better for Slave and Master to be in the same LAN.

==== What are the best scenarios for Redis? (1), Session Cache (2), Full Page Cache (3), Queue (4), Leaderboard/Counter (5), Publish/Subscribe

What are the differences between ====Memcache and Redis? (1) The storage mode is different. Memcache stores all the data in memory, and the data cannot exceed the size of memory. After power failure, the database will fail. Part of Redis is stored on the hard disk, which ensures the persistence of the data. (2) Different types of data support Memcahe has relatively simple data type support while Redis has complex data types. (3) Using the underlying model is different in the underlying implementation between them and the application protocol of communication between them and the client. Redis built the VM mechanism itself, because a normal system call to a system function would waste some time moving and requesting. (4) Different value sizes are supported. The maximum value of Redis is 1GB, while Memcache is only 1MB.

==== What kinds of data structures are there in Redis? And how to use it?

There are five types of Redis data structures. They are: The String data structure is a simple key-value type. Value can be either a String or a number (encoding is an integer when numeric types can be represented as Long). Everything else is stored in SDSHDR as strings). Use: Get, set, del, incr, decr 127.0.0.1:6379> set hello world OK 127.0.0.1:6379> get hello “world” 127.0.0.1:6379> del Integer 1 127.0.0.1:6379> get hello (nil) 127.0.0.1:6379> get counter “2” 127.0.0.1:6379> incr counter (Integer) 1 127.0.0.1:6379> incr counter (integer) 3 127.0.0.1:6379> get counter “3” 127.0.0.1:6379> incrby counter 100 (Integer) 103 127.0.0.1:6379> get counter “103” 127.0.0.1:6379> decr counter (integer) 102 127.0.0.1:6379> get counter “102” Hash — dictionary in Memcached, We often package some structured information, such as the user’s nickname, age, gender, credits, etc. into a HashMap that is serialized by the client and stored as a string value (typically in JSON format). Use: 127.0.0.1:6379> hset user name1 hao (Integer) 1 127.0.0.1:6379> hset user email1 Mailto :[email protected] (Integer) 1 127.0.0.1:6379> hgetall user 1) “name1” 2) “hao” 3) “email1” 4) “hmailto:” 127.0.0.1:6379> hget user name1 “hao” 127.0.0.1:6379> hset user name2 xiaohao 127.0.0.1:6379> hget user name2 xiaohao (integer) 1 127.0.0.1:6379> hset user email2 mailto:[email protected] (integer) 1 127.0.0.1:6379> hgetall user 1) “name1” 2) “hao” 3) “email1” 4) “hmailto:[email protected]” 5) “name2” 6) “xiaohao” 7) “email2” 8) “xmailto: “List List is simply a linked List (Redis uses a double-ended linked List), I believe that people who have learned data structure knowledge should be able to understand its structure. Use: Lpush +rpop= Stack lpush+rpop=Queue lpush+ltrim=Capped Collection lpush+brpop=Message Queue lpush+brpop= Stack lpush+rpop= Stack lpush+rpop=Queue lpush+ltrim=Capped Collection 127.0.0.1:6379> lRange myList 0-1 1) “mem” 2) “ls” 3) “ll” 4) “2” 5) “1” Set — Set A Set is just a Set, and the idea of a Set is just a bunch of combinations of values that don’t repeat. Using the Set data structure provided by Redis, some sets of data can be stored for use: sadd, srem, scard, smembers, sismember whose commands all start with s. 127.0.0.1:6379> sadd myset hao hao1 127.0.0.1:6379> SMEMBERS myset 1) “xiaohao” 2) “hao1” 3) “Hao” 127.0.0.1:6379> sisMember mySet (Integer) 1 zSet — The value of an element in a Set is added to the score, The elements in the collection can be arranged in order according to score, using: Zadd, zrange, zscore 127.0.1:6379 > zadd myscoreset 100 hao 90 xiaohao (integer) 2 127.0.0.1:6379> ZRANGE myscoreset 0-1 1) “xiaohao” 2) “hao” 127.0.0.1:6379> ZSCORE myscoreset 0-1 1) “xiaohao” 2) “127.0.0.1:6379> ZSCORE myscoreset 0-1”

More interview questions can be paid attention to the official account of “Demo Lock Screen Interview Questions”. Interview questions and learning resources can be obtained through the mini program or APP