Closed kostya closed 6 years ago
simple benchmark not show any difference in performance with master:
require "./src/redis"
r = Redis.new(port: 7777)
t = Time.now
20000.times do |i|
r.set("bla#{i}", i.to_s)
end
p Time.now - t
t = Time.now
s = 0_u64
20000.times do |i|
if v = r.get("bla#{i}")
s += v.bytesize
end
end
p s
p Time.now - t
Thank you for the PR! 😄
there is still not solved things,
example:
r = Redis.new
r.get("bla")
sleep 500
r.pipelined do
# ...
end
pipelined would crash by disconnected, pipeline not use reconnect, because we cannt call all blocks twice, and it need to remarshal all tasks. Multi also would not reconnect. But this is hard and rare things, i think this is ok, until we find how to fix it.
Regarding pipelined
: yes, I agree.
may be pipeline and multi should collect all commands in buffer, not in socket, and then execute it with one command.
I believe this would be unexpected for the user. But also, the current reconnect behaviour seems fine to me with respect to. pipeline and multi.
I have added a reconnect
option to the constructor.
We should be good now, no?
The reconnect
option is true
by default.
I will make a release later today or tomorrow, as I am running out of time at the moment.
i think i try add pool, and with pool and command_timeout, it can be 2.0.0
btw, maybe add option to reconnect or not?
Fixed
test-reconnection.cr
was
became
test-reconnection2.cr
was
became