单节点etcd集群,etcd版本是3.4.9。
编译etcd benchmark
git clone https://github.com/etcd-io/etcd.git
cd etcd/
git checkout v3.4.9
rm -rf vendor
go install -v ./tools/benchmark
go list -f "{{.Target}}" ./tools/benchmark
写入测试Key
ENDPOINTS=https://192.168.3.14:2379
CACERT=/etc/kubernetes/pki/etcd/ca.crt
SERVERCERT=/etc/kubernetes/pki/etcd/server.crt
SERVERKEY=/etc/kubernetes/pki/etcd/server.key
TEST_KEY=test
ETCDCTL_API=3 ./etcdctl --endpoints=$ENDPOINTS --cacert=$CACERT --cert=$SERVERCERT --key=$SERVERKEY put $TEST_KEY $TEST_KEY
写测试
./benchmark --endpoints=$ENDPOINTS --cacert=$CACERT --cert=$SERVERCERT --key=$SERVERKEY --conns=100 --clients=1000 put --key-size=8 --sequential-keys --total=100000 --val-size=256
读测试
./benchmark --endpoints=$ENDPOINTS --cacert=$CACERT --cert=$SERVERCERT --key=$SERVERKEY --conns=100 --clients=1000 range $TEST_KEY --consistency=l --total=100000
--consistency=l和s区别是,l是线性一致性读(半数以上达成一致),s是序列化非一致性读,etcd默认读模式是线性读。
标签:key,测试,Etcd,--,读写,benchmark,SERVERKEY,etcd,ENDPOINTS From: https://www.cnblogs.com/WJQ2017/p/18008882