Shadow
Shadow

Reputation: 45

Is redis server execute client commands in queue order?

First of all, my understanding is: redis is a single-process program, all commands are executed in first-in-first-out order. If this is the case, we don't need the watch command, but this is not the case.

I want to find out more about the order of execution of the redis command. Thanks in advance

Upvotes: 0

Views: 1026

Answers (1)

Tug Grall
Tug Grall

Reputation: 3520

You are correct, the Redis server will execute, the command in the order they are received independently of the client.

That said, it is interesting to know that you have some features like transaction and pipelining that do not have a direct impact on the execution order (not totally for a transaction, as you will see below)

In a transaction, "all the commands in a transaction are serialized and executed sequentially". All the commands are executed as a single isolated operation. So when you are running commands in the transaction, it is not possible to have commands from another client to be executed before the end of the transaction.

As described above the operation will be executed in order (FIFO), using pipelining that does not change, but what is different is that the client is able to send multiple commands without waiting for the response.

I let you look into the details of all this and test it in your application if needed.

Upvotes: 1

Related Questions