Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do long running operations lock redis?

Tags:

redis

In Redis, some operations such as SINTERSTORE have

Time complexity: O(N*M) worst case where N is the cardinality of the smallest set and M is the number of sets.

In my use case, I expect to be comparing sets of upwards of 15,000 items each. Performing an N*M operation on these sets would be O(30,000). There is no time requirement for the operation, meaning I don't care how long it takes. My question is whether my Redis will lock while this calculation is happening. Any ideas?

like image 640
Max Avatar asked Sep 24 '13 19:09

Max


2 Answers

The simple answer is "Yes", because Redis is based on a single threaded architecture.

The non-simple answer is "it depends" - if you shard your Redis in an optimized manner, only the shard that does this complex operation is blocked, the other shards are not.

like image 178
Yiftach Avatar answered Sep 18 '22 17:09

Yiftach


Redis is single-threaded. It doesn't lock anything, but it won't process any other commands until that one finishes. So it's as if Redis were locked, which I think is what you meant.

See also: Locking and Redis

like image 39
Or Neeman Avatar answered Sep 22 '22 17:09

Or Neeman