Atomicity vs Multithreading

I remember reading somewhere that (please correct me if this is wrong) that KeyDB multithreads the networking and command parsing… but what about command execution? Is that still single threaded, or parallelized about key? I’m concerned about module commands operating on keys unknown to the outer server layers.

I know the Alibaba work suggested multithreading everything but the command processing.

Hi @victorstewart

For modules KeyDB synchronizes with a “module lock”. This lock prevents KeyDB from executing commands while the module is running. As a result we provide the same guarantees to modules as Redis does. We run the same module tests as Redis to ensure compatibility but if you find a scenario where we behave differently that’s a bug.

1 Like

How realistic is it to make that module lock more granular? Maybe no lock until or unless a key is opened for writing, and then only a lock on that key? For heavy module usage patterns all command execution becomes essentially single threaded otherwise.

@jdsully still love to hear your thoughts on this