Redis async API using MULTI

Skip to first unread message

Naveen Kak

Jan 19, 2022, 10:41:40 AMJan 19
to Redis DB

While using a async hiredis client, is it guaranteed that all the async api’s invoked from the client will be executed in a  sequential order on the redis server? 

I thought since connection to Redis server is over TCP, so everything should be delivered to server in order.

I see some articles where they have raised this reservation for using MULTI for async APIs.


Snippet from below link:


It is impossible to use MULTI-EXEC over Redis Asynchronous API. You can only choose one.

MULTI-EXEC transactions SHOULD always execute sequentially. Redis Asynchronous API, on the other hand, allows the commands to be delivered out of order. Hence, it won't make sense to make a MULTI-EXEC transaction if the commands aren't in the proper sequence or worse, if MULTI and EXEC commands themselves became out of order.

Viktor Söderqvist

Jan 24, 2022, 5:58:42 AMJan 24
Hi Naveen,

Async commands are executed in order. TCP is ordered, as you say,
and it is possible to send multiple commands without waiting for
a response. This is called pipelining. MULTI-EXEC with pipelining
is a good idea. It is efficient. From

> (...) starting with Redis 2.6.5, the server will remember that
> there was an error during the accumulation of commands, and
> will refuse to execute the transaction returning also an error
> during EXEC, and discarding the transaction automatically.
> Before Redis 2.6.5 the behavior was to execute the transaction
> with just the subset of commands queued successfully in case
> the client called EXEC regardless of previous errors. The new
> behavior makes it much more simple to mix transactions with
> pipelining, so that the whole transaction can be sent at once,
> reading all the replies later at once.

There is no mention of out-of-order commands in the hiredis
README or in the Redis documentation. The information you found
seems wrong or at least very outdated.

> <>
> --
> You received this message because you are subscribed to the Google
> Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
> <>.
> To view this discussion on the web visit
> <>.
Reply all
Reply to author
0 new messages