Redis Memory Traps

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.