bench.sh 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash -e
  2. leader=http://localhost:2379
  3. # assume three servers
  4. servers=( http://localhost:2379 http://localhost:22379 http://localhost:32379 )
  5. keyarray=( 64 256 )
  6. for keysize in ${keyarray[@]}; do
  7. echo write, 1 client, $keysize key size, to leader
  8. ./hey -m PUT -n 10 -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c 1 -T application/x-www-form-urlencoded $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  9. echo write, 64 client, $keysize key size, to leader
  10. ./hey -m PUT -n 640 -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c 64 -T application/x-www-form-urlencoded $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  11. echo write, 256 client, $keysize key size, to leader
  12. ./hey -m PUT -n 2560 -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c 256 -T application/x-www-form-urlencoded $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  13. echo write, 64 client, $keysize key size, to all servers
  14. for i in ${servers[@]}; do
  15. ./hey -m PUT -n 210 -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c 21 -T application/x-www-form-urlencoded $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo &
  16. done
  17. # wait for all heys to start running
  18. sleep 3
  19. # wait for all heys to finish
  20. for pid in $(pgrep 'hey'); do
  21. while kill -0 "$pid" 2> /dev/null; do
  22. sleep 3
  23. done
  24. done
  25. echo write, 256 client, $keysize key size, to all servers
  26. for i in ${servers[@]}; do
  27. ./hey -m PUT -n 850 -d value=`head -c $keysize < /dev/zero | tr '\0' '\141'` -c 85 -T application/x-www-form-urlencoded $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo &
  28. done
  29. sleep 3
  30. for pid in $(pgrep 'hey'); do
  31. while kill -0 "$pid" 2> /dev/null; do
  32. sleep 3
  33. done
  34. done
  35. echo read, 1 client, $keysize key size, to leader
  36. ./hey -n 100 -c 1 $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  37. echo read, 64 client, $keysize key size, to leader
  38. ./hey -n 6400 -c 64 $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  39. echo read, 256 client, $keysize key size, to leader
  40. ./hey -n 25600 -c 256 $leader/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  41. echo read, 64 client, $keysize key size, to all servers
  42. # bench servers one by one, so it doesn't overload this benchmark machine
  43. # It doesn't impact correctness because read request doesn't involve peer interaction.
  44. for i in ${servers[@]}; do
  45. ./hey -n 21000 -c 21 $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  46. done
  47. echo read, 256 client, $keysize key size, to all servers
  48. for i in ${servers[@]}; do
  49. ./hey -n 85000 -c 85 $i/v2/keys/foo | grep -e "Requests/sec" -e "Latency" -e "90%" | tr "\n" "\t" | xargs echo
  50. done
  51. done