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.
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.
redisuse, the client will generally manage connection resources, such as allocating connections, monitoring connection status, and recycling connection pool resources
- By default,
rediswill not actively disconnect
redisthe 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
redisthe client reports an error when connecting, showing
"ERR max number of clients reached"
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?
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.
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.
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...
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 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.
- What data does Redis cache?
- How Redis caches department information reasonably
- In the subscription and publishing of redis, is the message sending sequential and blocking?
- Redis handles user sign-in issues
- Redis opens the lazy-free mechanism, is it locked internally?
- How to keep the php + redis inventory and database consistent with the second-kill system?
- What to do after Redis avalanche?
- How to achieve the number of unread users in mass message?
- Redisson sentinel configuration failed to start
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~