1

It isn't very clear whether it is a proper practice to pipeline a transaction. The throughput gain of pipelining is significant.

Benchmark.ips do |x|
  x.report("non-pipelined") do
    redis.watch("key")
    redis.multi
    redis.setex("key", 3600, 123)
    redis.exec
  end
  x.report("pipelined") do
    redis.watch("key")
    redis.pipelined do
      redis.multi
      redis.setex("key", 3600, 123)
      redis.exec
    end
  end
end

Warming up --------------------------------------
       non-pipelined    10.000  i/100ms
           pipelined    17.000  i/100ms
Calculating -------------------------------------
       non-pipelined     95.237  (± 9.5%) i/s -    470.000  in   5.015991s
           pipelined    177.370  (±10.7%) i/s -    884.000  in   5.054327s

I am concerned that MULTI may not be executed successfully but then SET will still be processed outside of a transaction. It does not sound like a good practice.

Any thoughts?

arthurc
  • 45
  • 5

0 Answers0