evio/benchmarks/bench-redis.sh

44 lines
1.1 KiB
Bash
Raw Normal View History

2017-11-03 04:31:36 +03:00
#!/bin/bash
2017-11-04 02:39:28 +03:00
set -e
pl=$1
if [ "$pl" == "" ]; then
pl="1"
fi
2017-11-03 04:31:36 +03:00
echo ""
2017-11-04 02:39:28 +03:00
echo "--- BENCH REDIS PIPELINE $pl START ---"
2017-11-03 04:31:36 +03:00
echo ""
cd $(dirname "${BASH_SOURCE[0]}")
function cleanup {
2017-11-04 02:39:28 +03:00
echo "--- BENCH REDIS PIPELINE $pl DONE ---"
kill -9 $(jobs -rp)
2017-11-03 04:31:36 +03:00
wait $(jobs -rp) 2>/dev/null
}
trap cleanup EXIT
mkdir -p bin
2017-11-04 02:39:28 +03:00
$(pkill -9 redis-server || printf "")
$(pkill -9 evio-redis-server || printf "")
2017-11-03 04:31:36 +03:00
function gobench {
2017-11-04 02:39:28 +03:00
echo "--- $1 ---"
2017-11-03 04:31:36 +03:00
if [ "$3" != "" ]; then
go build -o $2 $3
fi
2017-11-03 23:22:31 +03:00
GOMAXPROCS=1 $2 --port $4 &
2017-11-03 04:31:36 +03:00
sleep 1
2017-11-04 02:39:28 +03:00
echo "*** 50 connections, 1000000 commands, $pl commands pipeline"
redis-benchmark -p $4 -t ping_inline -q -c 50 -P $pl -n 1000000
# echo "*** 50 connections, 1000000 commands, 10 commands pipeline"
# redis-benchmark -p $4 -t ping_inline -q -c 50 -P 10 -n 1000000
# echo "*** 50 connections, 1000000 commands, 20 commands pipeline"
# redis-benchmark -p $4 -t ping_inline -q -c 50 -P 20 -n 1000000
echo "--- DONE ---"
2017-11-03 04:31:36 +03:00
echo ""
}
2017-11-04 02:39:28 +03:00
gobench "REAL REDIS" redis-server "" 6392
gobench "EVIO REDIS CLONE" bin/evio-redis-server ../examples/redis-server/main.go 6393