I have compiled all Java-related interview questions and answers into PDF, and bookmarked the table of contents, which is very convenient to read
questions and answers PDF download : https://www.hicxy.com/?p=2645
questions and answers PDF download : https://www.hicxy.com/?p=2645
questions and answers PDF download : https://www.hicxy.com/?p=2645
1. Why does redis need to put all data in memory?
In order to achieve the fastest read and write speed, Redis reads all the data into the memory and writes the data to the disk in an asynchronous manner. So redis has the characteristics of fast and data persistence. If you don't put the data in the memory, the disk I/O speed will seriously affect the performance of redis. Today, when memory is getting cheaper and cheaper, redis will become more and more popular.
If the maximum memory usage is set, new values cannot be inserted after the number of existing data records reaches the memory limit.
2. How many dbs does the database default in Redis?
Redis supports 16 databases by default, and this number can be modified by configuring databases. After the client establishes a connection with Redis, it will automatically select the 0 database, but you can use the select command to replace the database at any time.
Redis supports multiple databases, and each database is isolated and cannot be shared, and is based on a single machine. If it is a cluster, there is no concept of a database.
3. Other implementations of Redis transactions
- Based on Lua scripts, Redis can ensure that the commands in the script are executed one-time and sequentially.
It also does not provide the rollback of transaction errors. If some commands run incorrectly during execution, the remaining commands will continue to run to completion. - Based on the intermediate tag variable, another tag variable is used to identify whether the transaction is completed. When reading data, the tag variable is first read to determine whether the transaction is completed. But this will require additional code to be implemented, which is more cumbersome
4. How to choose a database for Redis cluster?
Redis cluster is currently unable to make database selection, the default is 0 database.
5. How to use
GEOADD key longitude latitude member [longitude latitude member ...]
Add the given location object (latitude, longitude, name) to the specified key. Among them, key is the name of the collection, and member is the object corresponding to the latitude and longitude. In actual application, when the number of objects to be stored is too large, you can sharding the object collection in disguise by setting multiple keys (such as one saving one key) to avoid the excessive number of single collections.
Return value after successful insertion:
(integer) N
Where N is the number of successful insertions.
For the rest of the problem, you can first think about it for yourself.
In addition, I have sorted out all Java-related interview questions and answers for your reference
questions and answers PDF download : https://www.hicxy.com/?p=2645
questions and answers PDF download : https://www.hicxy.com/?p=2645
questions and answers PDF download : https://www.hicxy.com/?p=2645
6. How does the Redis recycling process work?
7. Are there any ways to reduce the memory usage of Redis?
8. Periodically delete policies
9. Redis internal structure
10. What is the memory usage of Redis?
11. Why do Redis partitions?
12. Lock mutual exclusion mechanism
13. Advantages and disadvantages of RDB and AOF
14. Overview of Transaction Management (ACID)
15. What is the maximum number of nodes in a Redis cluster?
16. How to expand Redis persistent data and cache?
17. How is Redis different from other key-value stores?
18. What kinds of data elimination strategies does Redis have?
19. What kinds of persistence methods does Redis provide?
20. How to set the expiration time and permanent validity of Redis key?
21. Redis common performance problems and solutions
22. How does Redis realize "people nearby"
23. Why is Redis single-threaded
24. Under what circumstances will the Redis cluster solution cause the entire cluster to be unavailable?
25. When choosing a cache, when to choose redis and when to choose memcached?
26. What should the Redis cluster solution do? What are the options?
27. How is redis deployed in the production environment?
28. Redis is single-threaded, how to improve the utilization of multi-core CPU?
29. How to set the expiration time and permanent validity of Redis key?
30. How is replication between Redis clusters?
31. Why use redis/why use cache
32. How many keys can a Redis instance store at most? How many elements can be stored in List, Set, Sorted Set?
33. How does Redis optimize memory?
34. How to choose a suitable persistence method?
35. Locking mechanism
36. How to understand Redis transaction?
37. The three stages of Redis transactions
38. What are the redis expiration strategies? Does the LRU algorithm know?
39. What are the disadvantages of Redis partitions?
40. Redis's expiration strategy and memory elimination mechanism
41. What physical resources does Redis consume?
42. What are the suitable scenarios for Redis?
43. Timed delete strategy
44. What is the difference between redis and memcached? Why is sometimes single-threaded redis more efficient than multi-threaded memcached under high concurrency?
45. Redis commonly used management commands
46. Redis common data structure and usage scenario analysis
47. Cache avalanche and cache penetration problem solutions
48. What are the commands related to Redis transactions?
49. Do you know the persistence of redis? How is the bottom layer achieved? What are the advantages and disadvantages?
50. Why is the operation of Redis atomic, and how to ensure atomicity?
51. Why is Redis so fast
52. What is Redis persistence?
53. Features of Reids
54. Why doesn't Redis officially provide a Windows version?
55. Explain the Redis threading model
56. Will there be write operation loss in Redis cluster? Why?
57. Lazy delete strategy
58. There are 2000w data in MySQL, and only 20w data is stored in redis. How to ensure that the data in redis are all hot data?
59. Do you know what Redis partitioning schemes are available?
60. Which data types does Redis support?
61. What is Redis? Briefly describe its advantages and disadvantages?
62. What is the maximum storage capacity for a string type value?
63. What are the Redis data elimination strategies?
64. Why does Redis need to put all data in memory?
65. Cache penetration, cache breakdown, and cache avalanche solutions?
66. What is the master-slave replication model of Redis cluster?
67. Will the modified configuration take effect in real time without restarting Redis?
68. Tell me about the concept of Redis hash slot?
69. What are the advantages and disadvantages of Redis
70. What is the persistence mechanism of Redis? Their advantages and disadvantages?
71. Have you ever used Redis as an asynchronous queue and how did you achieve it?
72. How to deal with a large number of requests
73. How to ensure the data consistency between the cache and the database when it is double-written?
74. Redis persistence mechanism (how to ensure that the data can be restored after redis hangs and restarts)
75. What happens when Redis's memory runs out?
76. Does Redis transaction support isolation?
77. What are the suitable scenarios for Redis?
78. Redis transaction
79. How Redis implements delay queue
80. How to choose a suitable persistence method
81. Redis's expired key deletion strategy
82. Reids three different deletion strategies
83. What is the use of pipelines in Redis?
84. What to do if the cache is inconsistent with the database
85. Redis data types and usage scenarios of each data type
86. Please use Redis and any language to implement a malicious login protection code, and limit each user ID can only log in at most 5 times within 1 hour. The specific login function or function can be used as an empty function, and there is no need to write it out in detail.
87. The concept of Redis transactions
88. What are the advantages of Redis compared to memcached?
89. What should the Redis cluster solution do? What are the options?
90. Should distributed Redis be done at the early stage or at the later stage when the scale is up? Why?
91. Watch dog automatic extension mechanism
92. What are the benefits of using redis?
93. How to solve Redis's concurrent competition Key problem
94. Redis common performance problems and solutions?
95. Why single-threaded redis is so fast
96. Have you used Redis as an asynchronous queue? How do you use it? What are the disadvantages?
97. We know that the expiration time of the key is set through expire, so how to deal with the expired data?
98. How to design distributed locks using redis? Talk about the realization idea? Is it okay to use zk? How to achieve? What is the difference between these two?
99. What is cache penetration? How to avoid it? What is a cache avalanche? How to avoid it?
100. Does Redis transaction guarantee atomicity and does it support rollback?
101. How does Redis optimize memory?
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。