Troubleshooting Redis Response Latency Issues

Source: Internet
Author: User

Reference Original: Http://redis.io/topics/latency

More recent data volume, concurrent write operations in many cases, Redis has a slow response situation;

You can use Redis commands to test the response speed of Redis:

redis-cli--latency-h ' xxx '-P ' xxxx '

This command inserts sample data into Redis to check the average delay. CTRL + C can end the test at any time;

Let's make a list of possible delays:

    • Hardware, System: Hardware problems are the bottom of all problems, if the hardware is slow, such as low CPU, memory, disk IO slow, which will make all the system running in the response is slow, in addition, the use of virtual opportunity to make the system performance is too degraded; Of course, if you have money, the problem is easy to solve; The system resource scheduling of Linux itself also generates some delay. These are generally not very large, negligible;

    • Network: If the client and Redis are on the same server, using a socket to establish a connection is much faster than listening to the TCP/IP port;

    • Redis command: Some commands, such as lrem,sort,sunion, which are more complex in time, can take a long time, in addition, a large number of repeated connections can also cause delays, and reuse of connections is a good quality; If you have a lot of write operations, use pipeline Pipeline way (similar to MySQL transaction), a one-time commit, so that the amount of data is less, the number of connections is also less, do not have to return data, the speed will naturally be much faster;

    • Persistence: Redis persistence needs to fork out a process for persistent operation, which in itself will trigger a delay, if the data changes large, the RDB configuration time is short, then the cost is quite large, plus, hard disk this thing is a bit unreliable, if it is virtual machine on the virtual hard disk, If it's still an NFS shared directory, then this delay will cause you to crash. So, if the system doesn't need to be persisted, turn it off.


Redis provides slowlog can be used to analyze the slow execution of the command, you can analyze the operating system, you can use Iostat to see the speed of the hard disk, using Vmstat to view the memory paging situation;

The overall optimization is good, the system response will be faster;




Troubleshooting Redis Response Latency Issues

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.