pipelining vs transaction in redis

后端 未结 1 1702
灰色年华
灰色年华 2020-12-23 12:26

When we use a transaction in Redis, it basically pipelines all the commands within the transaction. And when EXEC is fired, then all the commands are executed together, thus

相关标签:
1条回答
  • 2020-12-23 13:16

    Pipelining is primarily a network optimization. It essentially means the client buffers up a bunch of commands and ships them to the server in one go. The commands are not guaranteed to be executed in a transaction. The benefit here is saving network round trip time for every command.

    Redis is single threaded so an individual command is always atomic, but two given commands from different clients can execute in sequence, alternating between them for example.

    Multi/exec, however, ensures no other clients are executing commands in between the commands in the multi/exec sequence.

    0 讨论(0)
提交回复
热议问题