头图

REmote DIctionary Server (Redis) is a key-value storage system written by Salvatore Sanfilippo. Redis provides some rich data structures, including lists, sets, ordered sets and hashes, and of course the same strings structure as Memcached. Redis of course also includes rich operations on these data structures.

文章推荐

"Redis data structure and internal coding"

The external data structures of Redis include: string (string), hash (hash), list (list), set (set) and ordered set (zset). These data structures have corresponding APIs that can be used on the client side. Each of the above data structures corresponds to more than one internal encoding implementation within Redis. Redis selects a more appropriate internal encoding based on the stored data to achieve a balance between memory and performance.

"Solving the Redis connection error "ERR max number of clients reached""

  • redis use, the client will generally manage connection resources, such as allocating connections, monitoring connection status, and recycling connection pool resources
  • By default, redis will not actively disconnect
  • redistimeout ,默认单位是秒,当timeout是0的时候, redis主动关闭连接
  • Because redis the default maximum number of connections is 10000, but if the connection is not closed all the time, the connection will accumulate over time, and eventually no connection will be available.

Eventually lead to redis the client reports an error when connecting, showing "ERR max number of clients reached"

"Three feet in the ground to solve the problem of data consistency between Redis and MySQL"

Redis has high-performance data read and write functions, and is widely used in caching scenarios. First, it can improve the performance of business systems, and second, it can resist high concurrent traffic requests for the database.
Using Redis as a cache component needs to prevent some of the following problems, otherwise it may cause production accidents.
What should I do if the Redis cache is full?
How to solve cache penetration, cache breakdown, and cache avalanche?
Will Redis data be deleted immediately when it expires?
Redis suddenly slows down, how to do performance troubleshooting and solve it?
How to deal with the data consistency problem between Redis and MySQL?

"What are the usage scenarios of Redis"

Redis, as an in-memory non-relational database, is almost always used in large and small Internet factories, large projects and small projects. Why is Redis so favored? Regarding this issue, many programmers may just use it while watching others, and lack a comprehensive understanding of Redis.

"Remember a Redis O(n) command to slow down the interface"

One day, I suddenly received an operation and maintenance alarm message, and it was reported that an interface in the production line was slow for a certain period of time, and the JIRA task for performance optimization was also started. The general content is as follows:

 API告警 - Base Tomcat Accesslog: 
微服务: xxxapi 
接口: /xxxx/xxx POST 
在 [ 2022/xx/xx 10:42:00 ~ 10:43:00 ] 时间窗口,RT > 阈值(300ms) 发生 141 次。

The company's internal response time requirements for APIs are less than 300ms, and the more than 300ms are all interfaces with performance problems.

"Redis - Principle of Master-Slave Synchronization"

In Redis master-slave mode, a highly available Redis service consists of a Redis master node (Master, hereinafter referred to as master node) and several Redis slave nodes (Slave, hereinafter referred to as slave nodes).
Redis uses read-write separation to ensure data consistency between master and slave nodes. The specific implementation is as follows...

《Redis does interface current limiting, an annotation thing! 》

In addition to caching, Redis can also do many things: distributed locks, current limiting, and processing request interface idempotency. . . too much too much~
Today, I want to talk to my friends about using Redis to handle interface current limiting. This is also the knowledge point involved in the recent TienChin project. I will bring it out and talk to you about this topic, and I will talk about it in the video later.

"Redis Knowledge Points & Interview Questions Summary"

Redis is an in-memory database that supports persistence. Data in memory is synchronized to hard disk files through a persistence mechanism to ensure data persistence. When Redis restarts, the data can be restored by reloading the hard disk files into memory.
Implementation: Create a fork() child process separately, copy the database file of the current parent thread to the memory of the child process, and then write it into the temporary file by the child process, the persistence process is over, and then replace it with this temporary file The last snapshot file, then the child process exits and the memory is freed.

问答推荐


PS: What technical content do you want to see, you can leave a message in the comment area~
If you have any questions, you can add Ms. WeChat~
image.png


Beverly
882 声望2.1k 粉丝

怂人面前全是坑,努力填坑 。


引用和评论

0 条评论