Hello, guys~
I noticed benchmark as a test tool in etcd.
A brief introduction is here:
https://coreos.com/etcd/docs/latest/op-guide/performance.html
When I use this tool , I feel strange that why it is so fast.
For example, it can complete a test with 10000 data inserted within 10 seconds.
On contrast, etcdctl command line may consume 10-15 minutes to insert 10000 kvs,
I am confused by this huge gap between their performances. Can anyone give me a brief explain on its reasons.
Thanks~
When I use this tool , I feel strange that why it is so fast.
For example, it can complete a test with 10000 data inserted within 10 seconds.
On contrast, etcdctl command line may consume 10-15 minutes to insert 10000 kvs,.
@WanLinghao
Speed considerations
Basically, from a quick review of benchmark the big thing to point out is concurrency. Below in my bash loop we need to wait for etcdctl put to complete before we run another transaction. But benchmark is using channels so it does not have to wait. Go handles concurrent transactions very well and is the main reason for the massive speed difference IMO.
#!/bin/bash
for i in {1..10000}
do
echo -e "$i \n";
etcdctl put foo${i} bar${i}
done
$ time ./test.sh
real 1m17.712s
user 0m49.294s
sys 0m35.657s
@WanLinghao I am going to close this, please feel free to continue the conversation here with any additional questions. Thanks!
My example assumed bash but please feel free to share your work so we can review if you like.
@WanLinghao
yes. as @hexfusion mentioned, concurrency is the biggest difference. at the server side, etcd can batch concurrent requests, and only do 1 disk sync.
another factor is the executable startup time is eliminated in the benchmark tool.