From: Waldemar Kozaczuk <[email protected]> Committer: Waldemar Kozaczuk <[email protected]> Branch: master
redis and keydb: added YCSB tests Signed-off-by: Waldemar Kozaczuk <[email protected]> --- diff --git a/keydb/test.sh b/keydb/test.sh --- a/keydb/test.sh +++ b/keydb/test.sh @@ -2,10 +2,18 @@ THIS_DIR=$(readlink -f $(dirname $0)) CMDLINE=$($THIS_DIR/../cmdline.sh $THIS_DIR) +TEST_TYPE=${1:-'benchmark'} + +case $TEST_TYPE in + benchmark) + TESTER=tester.py;; + ycsb) + TESTER=tester_with_ycsb.py;; +esac $THIS_DIR/../../scripts/tests/test_app_with_test_script.py \ -e "$CMDLINE" \ --guest_port 6379 \ --host_port 6379 \ --start_line 'Not listening to IPv6' \ - --script_path $THIS_DIR/tester.py + --script_path $THIS_DIR/$TESTER diff --git a/keydb/tester.py b/keydb/tester.py --- a/keydb/tester.py +++ b/keydb/tester.py @@ -1,11 +1,14 @@ import sys +import os import subprocess success = False print("Started keydb test ...") try: - output = subprocess.check_output(["redis-benchmark", "-t", "set,lpush", "-n", "100000", "-q"], stderr=subprocess.STDOUT).decode() + server_host = os.getenv('OSV_HOSTNAME') + output = subprocess.check_output(["redis-benchmark", "-h", server_host, "-t", "set,lpush", "-n", "100000", "-q"], + stderr=subprocess.STDOUT).decode() print(output) if 'requests per second' in output: diff --git a/keydb/tester_with_ycsb.py b/keydb/tester_with_ycsb.py --- a/keydb/tester_with_ycsb.py +++ b/keydb/tester_with_ycsb.py @@ -0,0 +1,30 @@ +import sys +import os +import subprocess + +success = False + +print("Started YCSB redis test ...") + +curr_dir = os.getcwd() +server_host = os.getenv('OSV_HOSTNAME') +ycsb_home = os.getenv('YCSB_HOME') #Home of the cloned http://github.com/brianfrankcooper/YCSB.git + +if not ycsb_home or not os.path.exists(ycsb_home): + print("Please set YCSB_HOME env variable that points to the directory of the http://github.com/brianfrankcooper/YCSB.git project") +else: + try: + os.chdir(ycsb_home) + output = subprocess.check_output(['./bin/ycsb', 'load', 'redis', '-s', '-P', 'workloads/workloada', + '-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode() + print(output) + output = subprocess.check_output(['./bin/ycsb', 'run', 'redis', '-s', '-P', 'workloads/workloada', + '-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode() + print(output) + + if '[UPDATE], Return=OK' in output: + success = True + except subprocess.CalledProcessError as err: + print(err.output) + finally: + os.chdir(curr_dir) diff --git a/redis-memonly/.gitignore b/redis-memonly/.gitignore --- a/redis-memonly/.gitignore +++ b/redis-memonly/.gitignore @@ -0,0 +1,2 @@ +redis-server +usr.manifest diff --git a/redis-memonly/test.sh b/redis-memonly/test.sh --- a/redis-memonly/test.sh +++ b/redis-memonly/test.sh @@ -2,10 +2,18 @@ THIS_DIR=$(readlink -f $(dirname $0)) CMDLINE=$($THIS_DIR/../cmdline.sh $THIS_DIR) +TEST_TYPE=${1:-'benchmark'} + +case $TEST_TYPE in + benchmark) + TESTER=tester.py;; + ycsb) + TESTER=tester_with_ycsb.py;; +esac $THIS_DIR/../../scripts/tests/test_app_with_test_script.py \ -e "$CMDLINE" \ --guest_port 6379 \ --host_port 6379 \ --start_line 'The server is now ready' \ - --script_path $THIS_DIR/tester.py + --script_path $THIS_DIR/$TESTER diff --git a/redis-memonly/tester.py b/redis-memonly/tester.py --- a/redis-memonly/tester.py +++ b/redis-memonly/tester.py @@ -7,7 +7,8 @@ print("Started redis test ...") try: server_host = os.getenv('OSV_HOSTNAME') - output = subprocess.check_output(["redis-benchmark", "-h", server_host, "-t", "set,lpush", "-n", "100000", "-q"], stderr=subprocess.STDOUT).decode() + output = subprocess.check_output(["redis-benchmark", "-h", server_host, "-t", "set,lpush", "-n", "100000", "-q"], + stderr=subprocess.STDOUT).decode() print(output) if 'requests per second' in output: diff --git a/redis-memonly/tester_with_ycsb.py b/redis-memonly/tester_with_ycsb.py --- a/redis-memonly/tester_with_ycsb.py +++ b/redis-memonly/tester_with_ycsb.py @@ -0,0 +1,30 @@ +import sys +import os +import subprocess + +success = False + +print("Started YCSB redis test ...") + +curr_dir = os.getcwd() +server_host = os.getenv('OSV_HOSTNAME') +ycsb_home = os.getenv('YCSB_HOME') #Home of the cloned http://github.com/brianfrankcooper/YCSB.git + +if not ycsb_home or not os.path.exists(ycsb_home): + print("Please set YCSB_HOME env variable that points to the directory of the http://github.com/brianfrankcooper/YCSB.git project") +else: + try: + os.chdir(ycsb_home) + output = subprocess.check_output(['./bin/ycsb', 'load', 'redis', '-s', '-P', 'workloads/workloada', + '-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode() + print(output) + output = subprocess.check_output(['./bin/ycsb', 'run', 'redis', '-s', '-P', 'workloads/workloada', + '-p', 'redis.host=%s' % server_host, '-p', 'redis.port=6379'], stderr=subprocess.STDOUT).decode() + print(output) + + if '[UPDATE], Return=OK' in output: + success = True + except subprocess.CalledProcessError as err: + print(err.output) + finally: + os.chdir(curr_dir) -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/000000000000b1d8ba05a3b1e79a%40google.com.
