aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/benchmark.py13
-rw-r--r--src/benchmarks/httpd.py58
-rw-r--r--src/benchmarks/mysql.py10
-rw-r--r--src/benchmarks/redis.py7
4 files changed, 43 insertions, 45 deletions
diff --git a/src/benchmark.py b/src/benchmark.py
index b2ae16b..bbb6d50 100644
--- a/src/benchmark.py
+++ b/src/benchmark.py
@@ -471,13 +471,19 @@ class Benchmark:
if l.startswith("VmHWM:"):
result["VmHWM"] = l.split()[1]
break
+
os.remove("status")
- # TODO: get VmHWM from servers
else:
result["server_status"] = []
for server in self.servers:
- with open("/proc/{}/status".format(server["popen"].pid), "r") as f:
- result["server_status"].append(f.read())
+ with open(f"/proc/{server['popen'].pid}/status", "r") as f:
+ server_status = f.read()
+ result["server_status"].append(server_status)
+
+ for l in server_status.splitlines():
+ if l.startswith("VmHWM:"):
+ result[f"{server.get('name', 'Server')}_vmhwm"] = l.split()[1]
+ break
# parse perf output if available
if self.measure_cmd == self.defaults["measure_cmd"] or self.measure_cmd_csv:
@@ -495,6 +501,7 @@ class Benchmark:
self.process_output(result, res.stdout, res.stderr,
alloc_name, perm)
+
# save a valid result so we can expand invalid ones
if valid_result is not None:
valid_result = result
diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py
index 7284e2e..64f8e11 100644
--- a/src/benchmarks/httpd.py
+++ b/src/benchmarks/httpd.py
@@ -14,7 +14,6 @@
#
# You should have received a copy of the GNU General Public License
# along with allocbench. If not, see <http://www.gnu.org/licenses/>.
-
"""Definition of the httpd benchmark"""
import re
@@ -25,12 +24,13 @@ import src.facter
class BenchmarkHTTPD(Benchmark):
"""TODO"""
-
def __init__(self):
name = "httpd"
- self.args = {"nthreads": Benchmark.scale_threads_for_cpus(2),
- "site": ["index.html", "index.php"]}
+ self.args = {
+ "nthreads": Benchmark.scale_threads_for_cpus(2),
+ "site": ["index.html", "index.php"]
+ }
self.cmd = "ab -n 10000 -c {nthreads} localhost:8080/{site}"
self.measure_cmd = ""
self.servers = [{"name": "nginx",
@@ -46,49 +46,41 @@ class BenchmarkHTTPD(Benchmark):
def prepare(self):
super().prepare()
- self.results["facts"]["versions"]["nginx"] = src.facter.exe_version("nginx", "-v")
- self.results["facts"]["versions"]["ab"] = src.facter.exe_version("ab", "-V")
+ self.results["facts"]["versions"]["nginx"] = src.facter.exe_version(
+ "nginx", "-v")
+ self.results["facts"]["versions"]["ab"] = src.facter.exe_version(
+ "ab", "-V")
@staticmethod
def process_output(result, stdout, stderr, allocator, perm):
- result["time"] = re.search("Time taken for tests:\\s*(\\d*\\.\\d*) seconds", stdout).group(1)
- result["requests"] = re.search("Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1)
-
- # with open("/proc/"+str(self.server.pid)+"/status", "r") as f:
- # for l in f.readlines():
- # if l.startswith("VmHWM:"):
- # result["rssmax"] = int(l.replace("VmHWM:", "").strip().split()[0])
- # break
+ result["time"] = re.search(
+ "Time taken for tests:\\s*(\\d*\\.\\d*) seconds", stdout).group(1)
+ result["requests"] = re.search(
+ "Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1)
def summary(self):
allocators = self.results["allocators"]
- self.calc_desc_statistics()
-
- # linear plot
self.plot_fixed_arg("{requests}",
xlabel='"threads"',
ylabel='"requests/s"',
autoticks=False,
filepostfix="requests",
- title='"ab -n 10000 -c " + str(perm.nthreads)')
+ title='perm.site + ": requests/s"')
- # linear plot
- ref_alloc = list(allocators)[0]
- self.plot_fixed_arg("{requests}",
+ self.plot_fixed_arg("{nginx_vmhwm}",
xlabel='"threads"',
- ylabel='"requests/s scaled at " + scale',
- title='"ab -n 10000 -c " + str(perm.nthreads) + " (normalized)"',
- filepostfix="requests.norm",
- autoticks=False,
- scale=ref_alloc)
-
- # bar plot
- # self.barplot_fixed_arg("{requests}",
- # xlabel='"threads"',
- # ylabel='"requests/s"',
- # filepostfix="b",
- # title='"ab -n 10000 -c threads"')
+ ylabel='"VmHWM in KB"',
+ title='perm.site + ": nginx memory usage"',
+ filepostfix="httpd_vmhwm",
+ autoticks=False)
+
+ self.plot_fixed_arg("{php-fpm_vmhwm}",
+ xlabel='"threads"',
+ ylabel='"VmHWM in KB"',
+ title='perm.site + ": php-fpm memory usage"',
+ filepostfix="php-fpm_vmhwm",
+ autoticks=False)
httpd = BenchmarkHTTPD()
diff --git a/src/benchmarks/mysql.py b/src/benchmarks/mysql.py
index d5c0cb9..0d24ff6 100644
--- a/src/benchmarks/mysql.py
+++ b/src/benchmarks/mysql.py
@@ -192,12 +192,6 @@ class BenchmarkMYSQL(Benchmark):
result["avg"] = re.search("avg:\\s*(\\d*.\\d*)", stdout).group(1)
result["max"] = re.search("max:\\s*(\\d*.\\d*)", stdout).group(1)
- with open(f"/proc/{self.servers[0]['popen'].pid}/status", "r") as f:
- for l in f.readlines():
- if l.startswith("VmHWM:"):
- result["rssmax"] = int(
- l.replace("VmHWM:", "").strip().split()[0])
- break
def summary(self):
allocators = self.results["allocators"]
@@ -235,7 +229,7 @@ class BenchmarkMYSQL(Benchmark):
scale=ref_alloc)
# Memusage
- self.barplot_single_arg("{rssmax}",
+ self.barplot_single_arg("{mysqld_vmhwm}",
xlabel='"threads"',
ylabel='"VmHWM in kB"',
title='"Memusage sysbench oltp read only"',
@@ -247,7 +241,7 @@ class BenchmarkMYSQL(Benchmark):
"sort": ">"
}, {
"label": "Memusage [KB]",
- "expression": "{rssmax}",
+ "expression": "{mysqld_vmhwm}",
"sort": "<"
}],
filepostfix="table")
diff --git a/src/benchmarks/redis.py b/src/benchmarks/redis.py
index 827b14c..b487baf 100644
--- a/src/benchmarks/redis.py
+++ b/src/benchmarks/redis.py
@@ -87,9 +87,14 @@ class BenchmarkRedis(Benchmark):
def summary(self):
self.barplot_single_arg("{requests}",
ylabel='"requests per s"',
- title='"redis benchmark"',
+ title='"redis throughput"',
filepostfix="requests")
+ self.barplot_single_arg("{redis_vmhwm}",
+ ylabel='"VmHWM in KB"',
+ title='"redis memusage"',
+ filepostfix="vmhwm")
+
self.export_stats_to_dataref("requests")