Closed lafolle closed 6 years ago
the non-blocking snapshot only works for etcd3 backend not etcd2 backend. simply changing the version of etcd wont help. you actually need to migrate the data from etcd2 backend to 3.
Hi @xiang90 , migration is not a problem for us.
But when we loaded etcdv3.3.8 with test data (~>1M keys) it started triggering elections specifically at the time of snapshotting because of reasons i have mentioned above.
Do you think our reasoning is valid?
Thanks, Karan
how do you load the test data?
We load data using go etcd client library.
The problem we think is that etcdserver.store.HasTTL()
gets stuck on lock during snapshotting (as store.Clone acquires full lock and can take time) which delays sending heartbeat to followers.
etcdserver/v2store.HasTTL(): https://github.com/coreos/etcd/blob/master/etcdserver/server.go#L1051 etcdserver/v2store.Clone(): https://github.com/coreos/etcd/blob/master/etcdserver/api/v2store/store.go?#L750
@lafolle You are still using v2 backend. See what I said above. I am going to close this issue as we are not going to scale up v2 backend.
I reproduced the problem in etcd 3.2.3.
Configuration
etcd Version: 3.3.8 Git SHA: 33245c6b5 Go Version: go1.10.3 Go OS/Arch: linux/amd64 --snapshot-count: 100 --heartbeat-timeout: 100ms --election-timeout: 1000ms Number of nodes: 1M
What we observed?
Leader election getting triggered on snapshotting.
What we think is the cause
Abbreviations:
Here is rough flow of control starting from sending heartbeat.
When snapshot is triggered, G3:E4 can take more than 1s to finish (in our case store is 1M nodes) which possiblty will block G4 when getSync is triggered (default: 500ms) at G4:E3, which in turn blocks G1 at G1:E1, which delays sending heartbeat at G1:E2.
Possible Solution
For the record we initially faced this problem with v2.2.0, but in that case snapshot was synchronous in event loop because of which
store.Clone
did trigger missed heartbeats. Hence we bumped up the version to v3.3.8 but still faced the problem which tripped us because snapshot seemed to be done asynchronously.Let me know if more data is needed.
Thanks, Karan