diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-03-08 11:17:42 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-03-08 11:17:42 +0100 |
| commit | 9ebf84850b1d2c7d5501d22fe1687f2fba2caa3f (patch) | |
| tree | 300a9b32dc07a82c4d33ed857e255c30a1f00546 | |
| parent | d2a6217987709ba567a3252effe63ad4794106d2 (diff) | |
| download | allocbench-9ebf84850b1d2c7d5501d22fe1687f2fba2caa3f.tar.gz allocbench-9ebf84850b1d2c7d5501d22fe1687f2fba2caa3f.zip | |
improve myqsl
start server with --max-connections=<cpu count>
don't reference mysql.server if not available
remove non empty mysql_test directory
| -rw-r--r-- | src/mysql.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mysql.py b/src/mysql.py index 0ba820e..a3ef708 100644 --- a/src/mysql.py +++ b/src/mysql.py @@ -1,6 +1,7 @@ import atexit import copy import matplotlib.pyplot as plt +import multiprocessing import numpy as np import os import re @@ -24,8 +25,10 @@ cmd = ("sysbench oltp_read_only --threads={nthreads} --time=60 --tables=5 " "--db-driver=mysql --mysql-user=root --mysql-socket=" + cwd + "/mysql_test/socket run") -server_cmd = ("{0} -h {1}/mysql_test --socket={1}/mysql_test/socket " - "--secure-file-priv=").format(shutil.which("mysqld"), cwd).split() +server_cmd = ("{0} -h {2}/mysql_test --socket={2}/mysql_test/socket " + "--max-connections={1} " + "--secure-file-priv=").format(shutil.which("mysqld"), + multiprocessing.cpu_count(), cwd).split() class Benchmark_MYSQL(Benchmark): @@ -59,7 +62,7 @@ class Benchmark_MYSQL(Benchmark): return self.server.poll() is None def terminate_server(self): - if self.server: + if hasattr(self, "server"): if self.server.poll() == None: print_info("Killing still running mysql server") self.server.kill() @@ -126,7 +129,7 @@ class Benchmark_MYSQL(Benchmark): def cleanup(self): if os.path.exists("mysql_test"): print_status("Delete mysqld directory") - shutil.rmtree("mysql_test") + shutil.rmtree("mysql_test", ignore_errors=True) def preallocator_hook(self, allocator, run, verbose): if not self.start_and_wait_for_server(cmd_prefix=allocator[1]["cmd_prefix"]): |
