I posted some transferred posts all day, and I have summarized them too little. write down what caused me a headache in redis some time ago. For this reason, the data of redis was originally migrated to tokyocabinet.
Redis is a nosql database with strong memory dependence. It has excellent performance when the memory is sufficient.
If you only have one machine to deploy redis, be careful.
For example, if I have a 24 GB server, I will allocate a large amount of memory to redis.
For example, the 20 GB memory is faulty. When you insert data to redis, redis will asynchronously dump the data to the hard disk.
The problem is that it will fork a process and occupy the same size of memory. The memory you need is 20g + 20g = 40g in an instant.
When the memory exceeds the limit of the physical memory, the virtual memory will be started immediately. On my host, the 8 GB virtual memory is used, and the focus is on the Linux virtual memory, it is not redis's own virtual memory.
Linux's Virtual Memory Page is very large, Io increases dramatically, and the dump speed will be very slow. The performance of the entire server will be reduced to freezing points, and service requests will be blocked. The worst case is that the machine breaks down.
For a single machine, it is best to reduce the redis virtual memory settings. The page can be modified according to the configuration. This virtual memory is much better than the Linux virtual memory because the page is much smaller.
If your apsaradb for redis has both read and write data, it is recommended that you do not allow apsaradb for redis to occupy more than half of the memory.
You can set its virtual memory to 8 GB, which also depends on the size of your key value, because the key must be in the memory, so that even if the virtual memory is enabled, the actual memory occupied by redis will also exceed the expectation.
God, that is to say, redis must be provided with a memory more than doubled. when data is not inserted at ordinary times, there is no need to leave the memory empty, which is a waste.
In addition, we recommend that you set virtual memory for data with small keys and large values.
In addition, the Master/Slave is not very mature. Currently, only the master and slave nodes are supported. redis adopts the non-blocking mode on the master node. That is to say, when the slave executes data synchronization, the master node can accept client requests, the synchronization data consistency is not affected. However, the slave end is in blocking mode. slave cannot respond to client queries when synchronizing master data.
In redis Master/Slave Mode, the master provides data read/write services, while the slave only provides read services.