Categories About Us Contact Us Become a Member

How to fix Redis TimeoutError and read timed out

This means the server took too long to respond, often because a slow command is blocking the single Redis thread. Finding and removing the slow command resolves it. Jump to your situation below or work through the methods in order.

By Neeraj Singh ~7 min Updated Jun 2026 87% found this helpful
Error message
TimeoutError / Read timed out waiting for a Redis response.
Summary

A Redis TimeoutError or read timed out means the server did not respond within the client's timeout. Redis processes commands on a single thread, so one slow, blocking command, classically KEYS * on a large keyspace, a big SORT, a heavy Lua script, or a large SMEMBERS/HGETALL, stalls every other client behind it. It can also be a network delay or an overloaded server. The fix is to find the slow commands with SLOWLOG GET, then remove or replace them: never run KEYS in production (use SCAN to iterate), avoid large blocking operations, and break big values into smaller pieces. Raising the client's timeout helps tolerate occasional spikes, and scaling or using replicas for reads relieves an overloaded instance. Removing the blocker is the real fix.

What this error means

Redis runs commands one at a time on a single thread, which is what makes it fast and predictable, but it also means a single slow command holds the line. While that command runs, everyone else waits, and clients whose timeout expires get a read timeout even though Redis is healthy.

So a timeout is usually a symptom of a blocking command rather than a broken server. The classic culprit is KEYS * scanning the whole keyspace. Finding the slow commands in the slow log and replacing them with non-blocking alternatives like SCAN removes the stall. Network or load issues are the other causes.

Common causes

A slow blocking command like KEYS * stalls the thread.
A large SORT, script, SMEMBERS or HGETALL.
Very large values being read at once.
An overloaded or under-provisioned server.
Network latency between client and server.
Client timeout set too low for the workload.
Expert insight

“A Redis timeout almost never means Redis is down, it means something is hogging the single thread and everyone else is queued behind it. Nine times out of ten it is a KEYS * someone left in the code, scanning millions of keys while the whole app stalls. So I pull SLOWLOG GET to catch the slow commands red-handed, swap KEYS for SCAN, and break up any giant values. Bumping the client timeout buys breathing room, but the real fix is killing the blocker.”

How to fix it

Method 1

Find slow commands with SLOWLOG

1List the slowest recent commands:
SLOWLOG GET 10
2Identify what is blocking the thread.
3Use LATENCY DOCTOR for a broader view.
Method 2

Replace KEYS with SCAN

1Never run KEYS in production; iterate without blocking:
SCAN 0 MATCH user:* COUNT 100
2SCAN returns results in small batches.
3The same applies to HSCAN, SSCAN and ZSCAN.
Method 3

Avoid large blocking operations

1Break large values into smaller keys, and avoid SMEMBERS or HGETALL on huge collections.
2Use ranged or cursor-based reads instead.
3Keep Lua scripts short.
Method 4

Raise the client timeout

1Increase the client's command and connection timeout to tolerate occasional spikes.
2This is a cushion, not a cure, fix the slow command too.
3Tune pool settings for your workload.
Method 5

Relieve an overloaded server

1If the server is saturated, add replicas for read traffic or scale the instance.
2Check INFO for CPU and memory pressure.
3Distribute load across a cluster if needed.

A Redis timeout usually means a slow command is blocking the single thread, classically KEYS *. Use SLOWLOG GET to find the culprit, replace KEYS with SCAN, and avoid large blocking operations. Raise the client timeout as a cushion, and scale or add read replicas if the server is overloaded.

Frequently asked questions

What causes a Redis TimeoutError?
The server did not respond within the client's timeout, usually because a slow blocking command, such as KEYS * on a large keyspace, is holding Redis's single thread while other clients wait.
How do I fix it?
Find slow commands with SLOWLOG GET, replace KEYS with SCAN, and avoid large blocking operations like SMEMBERS or HGETALL on huge collections. Raise the client timeout as a cushion and scale if overloaded.
Why is KEYS dangerous?
KEYS scans the entire keyspace in one blocking operation, stalling every other client while it runs. Use SCAN, which iterates in small non-blocking batches, in production instead.
Does raising the timeout fix it?
Only partly. A higher timeout tolerates occasional spikes but does not remove the blocking command. Fix the slow command as well, otherwise the stalls continue.
How do I find the slow command?
Run SLOWLOG GET 10 to see the slowest recent commands with their durations, and use LATENCY DOCTOR for a broader latency analysis. That points you at what to optimize.
Could it be the network or load?
Yes. Network latency between client and server, or an overloaded server, can also cause timeouts. Check INFO for CPU and memory pressure, and add read replicas or scale if needed.

Still not working?

If timeouts persist with no slow commands in the log, look at fork latency during RDB or AOF rewrites, which can pause Redis briefly, and at client-side pool exhaustion that mimics server timeouts. You can also submit your error to us for a tailored fix.

Was this fix helpful? Thanks for your feedback!