Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reasons for Redis to slow down

What could be the reasons for Redis slow work/response?

i.e. I found on Stackoverflow that storing large files or data in Redis makes it slow. What's else?

like image 848
shalakhin Avatar asked Nov 19 '12 09:11

shalakhin


People also ask

Why would Redis be slow?

Because Redis is single-‐threaded, command requests are processed sequentially. The typical latency for a 1Gb/s network is about 200 μs. If you are seeing slow response time for commands and latency that is significantly higher than 200 μs, it could be because there are a high number of requests in the command queue.

How much RAM do I need for Redis?

The minimum requirements of a Redis infrastructure for non-productive OutSystems environments are the following: Single Redis server with 2 CPUs (>2.6 Ghz) and 4GB of RAM (can be Virtual Machine)

What happens if Redis goes down?

When Redis goes down, you have to deal with it. It is the same as if your file system is gone or your SQL Server is down. A lot of those systems disable all writes and set their cluster in maintenance state.


1 Answers

There is no simple answer to this question. With all NoSQL or SQL based storage solutions, there are plenty of conditions that could result in high latency or slowness of the storage engine. Redis is no exception.

I would suggest to start by reading:

  • How fast is Redis?
  • Redis latency problems troubleshooting

Here is a non exhaustive list of potential reasons:

  • Inadequate hardware (network, memory, CPU)
  • Software based virtualization (Xen on low-end hardware for instance)
  • Not enough memory, generating swapping at the OS level
  • Too many O(n) operations (like KEYS) executed in the single-threaded engine
  • Large objects stored in Redis, leading to uncontrolled expansion of the communication buffers
  • Huge number of simultaneous sessions (>30000)
  • Too many connection operations per second (Redis is not a webserver, connections are supposed to be permanent, not transient).
  • Too many roundtrips generated by the client application (no pipelining or aggregated command usage)
  • Large fork operations generated by bgsave or AOF rewrite (especially on VMs)
  • I/O related latencies when AOF is used
  • Accumulation of many expire operations triggered at the same time
  • Accumulation of memory in client and master/slave communication buffers, or slow log data
  • TCP incast conditions when network bandwidth consumption is significant
  • Using distributed storage (and especially cloudy ones such as EC2 EBS) to store dump or AOF files

There are probably many other reasons, related to the workload generated by your own application.

If some people think about other general reasons, we can add them to this list.

like image 152
Didier Spezia Avatar answered Sep 19 '22 17:09

Didier Spezia