]> git.proxmox.com Git - mirror_ovs.git/commit
ovsdb raft: Sync commit index to followers without delay.
authorHan Zhou <hzhou8@ebay.com>
Fri, 12 Apr 2019 23:26:22 +0000 (16:26 -0700)
committerBen Pfaff <blp@ovn.org>
Mon, 15 Apr 2019 19:54:39 +0000 (12:54 -0700)
commit0f954f326dcd83ef8c70aebf19194adc0b1b69b9
treee8a6fb389c4b011150e72fa2c8c06e1256414cf4
parent2bcb3b7052c8c7d110ac9db37ac20c26f98f2215
ovsdb raft: Sync commit index to followers without delay.

When update is requested from follower, the leader sends AppendRequest
to all followers and wait until AppendReply received from majority, and
then it will update commit index - the new entry is regarded as committed
in raft log. However, this commit will not be notified to followers
(including the one initiated the request) until next heartbeat (ping
timeout), if no other pending requests. This results in long latency
for updates made through followers, especially when a batch of updates
are requested through the same follower.

$ time for i in `seq 1 100`; do ovn-nbctl ls-add ls$i; done

real    0m34.154s
user    0m0.083s
sys 0m0.250s

This patch solves the problem by sending heartbeat as soon as the commit
index is updated in leader. It also avoids unnessary heartbeat by resetting
the ping timer whenever AppendRequest is broadcasted. With this patch
the performance is improved more than 50 times in same test:

$ time for i in `seq 1 100`; do ovn-nbctl ls-add ls$i; done

real    0m0.564s
user    0m0.080s
sys 0m0.199s

Torture test cases are also updated because otherwise the tests will
all be skipped because of the improved performance.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
ovsdb/raft.c
tests/ovsdb-cluster.at