Redis is a highly memory-dependent NoSQL database that performs well with enough memory
If you have only one machine to deploy Redis, be very careful.
For example, I have a 24G server, which I would certainly allocate a lot of memory to Redis.
Like 20G of memory, the problem is, when you insert data into Redis, Redis asynchronously dumps the data to the hard disk
The problem is that it will fork a process and take up the same size of memory, and the memory you need will be 20g+20g =40g
At this time the memory exceeds the limit of physical memory, will start the virtual memory immediately, my machine is 8G virtual memory, the focus is that this is the virtual memory of Linux, not redis own virtual memory.
Linux Virtual memory page is large, IO spikes, dump speed is very slow, the performance of the entire server to the point of freezing, service requests will be blocked. The most serious to the machine broken down.
For a single machine it is best to reduce the Redis virtual memory settings, page can be modified according to the configuration, this virtual memory is much better than the virtual memory of Linux, because the page is much smaller.
If your redis has both read and write, it's best not to let Redis take up half of the memory.
You can set its virtual memory to 8G, depending on the size of your key value, because key must be in memory, so even if virtual memory is enabled, the actual memory that Redis takes up will exceed the assumptions.
Oh, my God, that means you have to give it to redis. He needs more than a memory, usually without inserting data, the memory is empty, waste.
In addition to the official documentation, it is recommended to set virtual memory for key small, value-large data.
In addition Master/slave is not very mature, currently only support Master and slave, Redis in the master is non-blocking mode, that is, when the slave to perform data synchronization, master can accept the client's request, does not affect the consistency of synchronization data, However, on the slave side is blocking mode, slave is not able to respond to client queries when synchronizing master data
According to the characteristics of Master/slave, Master does not dump, it is only responsible for writing data, let slave to dump
Redis Memory Traps