micah
micah

Reputation: 8116

How does LUA block on a Redis Cluster?

I understand LUA calls are blocking on Redis but I'm unclear on how they are blocked.

I have a Redis cluster with 3 nodes (R1, R2, R3) containing 6 keys (A, B, C, D, E, F) which are distributed evenly across nodes. My client C1 executes a LUA script on R1 targeting key A. Lets say this LUA script runs for 1 minute. During that time, C2 wants to fetch a key from, or run a LUA script against, key E in R3. Is C2 blocked until C2 finishes?

enter image description here

What if they are targeting different keys on the same node?

enter image description here

When a LUA script is executed on a redis cluster, what exactly is blocked?

Upvotes: 0

Views: 975

Answers (1)

Itamar Haber
Itamar Haber

Reputation: 50112

The node is blocked any time a command is executing, whether it is a Lua script, a simple GET, or anything else. This behavior is the same with a single-instance deployment and clustered deployment because the cluster is made up of multiple "single-instance"-like shards.

Upvotes: 2

Related Questions