From f50589d8f2dfa4499f04748dc83a1052ad39f7e7 Mon Sep 17 00:00:00 2001 From: Tpt Date: Wed, 23 Oct 2019 13:26:39 +0200 Subject: [PATCH] Improves benchmarks Make Virtuoso loading work Allows to limit Rudf memory Use bars for plot --- bench/bsbm-plot.py | 18 +++++++++++------- bench/bsbm_rudf.sh | 10 +++++++--- bench/bsbm_virtuoso.sh | 9 ++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/bench/bsbm-plot.py b/bench/bsbm-plot.py index 2fab3a87..5c9b896b 100644 --- a/bench/bsbm-plot.py +++ b/bench/bsbm-plot.py @@ -2,16 +2,20 @@ import xml.etree.ElementTree as ET import matplotlib.pyplot as plt from collections import defaultdict from glob import glob +from numpy import array - -def plot_y_per_x_per_plot(data, xlabel, ylabel, file): +def plot_y_per_x_per_plot(data, xlabel, ylabel, file, log=False): plt.figure(file) - for label, xys in data.items(): - plt.plot(list(xys.keys()), list(xys.values()), '.', label=label) + + bar_width = 1 / (len(data) + 1) + for i, (label, xys) in enumerate(sorted(data.items())): + plt.bar(array(list(xys.keys())) + bar_width * (i + 1 - len(data) / 2), array(list(xys.values())), bar_width, label=label) + plt.legend() plt.xlabel(xlabel) plt.ylabel(ylabel) - # plt.yscale('log') + if log: + plt.yscale('log') plt.savefig(file) @@ -23,7 +27,7 @@ for file in glob('bsbm.explore.*.xml'): val = float(query.find('aqet').text) if val > 0: aqet[run][int(query.attrib['nr'])] = val -plot_y_per_x_per_plot(aqet, 'query id', 'aqet', 'bsbm.explore.png') +plot_y_per_x_per_plot(aqet, 'query id', 'execution time (s)', 'bsbm.explore.png') # BSBM business intelligence aqet = defaultdict(dict) @@ -33,6 +37,6 @@ for file in glob('bsbm.businessIntelligence.*.xml'): val = float(query.find('aqet').text) if val > 0: aqet[run][int(query.attrib['nr'])] = val -plot_y_per_x_per_plot(aqet, 'query id', 'aqet', 'bsbm.businessIntelligence.png') +plot_y_per_x_per_plot(aqet, 'query id', 'execution time (s) - log scale', 'bsbm.businessIntelligence.png', log=True) plt.show() diff --git a/bench/bsbm_rudf.sh b/bench/bsbm_rudf.sh index 5ed528de..bf07bad5 100755 --- a/bench/bsbm_rudf.sh +++ b/bench/bsbm_rudf.sh @@ -1,14 +1,18 @@ #!/usr/bin/env bash DATASET_SIZE=100000 +MEMORY_SIZE=1000000 cd bsbm-tools ./generate -fc -pc ${DATASET_SIZE} -s nt -fn "explore-${DATASET_SIZE}" cargo build --release --manifest-path="../../server/Cargo.toml" -./../../target/release/rudf_server --file rudf_data & +( + ulimit -d ${MEMORY_SIZE} + ./../../target/release/rudf_server --file rudf_data +) & sleep 5 curl -f -X POST -H 'Content-Type:application/n-triples' --data-binary "@explore-${DATASET_SIZE}.nt" http://localhost:7878/ -./testdriver -ucf usecases/explore/sparql.txt -o "../bsbm.explore.rudf.${DATASET_SIZE}.$(date +'%Y-%m-%d').xml" http://localhost:7878/query -./testdriver -ucf usecases/businessIntelligence/sparql.txt -o "../bsbm.businessIntelligence.rudf.${DATASET_SIZE}.$(date +'%Y-%m-%d').xml" http://localhost:7878/query +./testdriver -ucf usecases/explore/sparql.txt -o "../bsbm.explore.rudf.${DATASET_SIZE}.${MEMORY_SIZE}.$(date +'%Y-%m-%d').xml" http://localhost:7878/query +./testdriver -ucf usecases/businessIntelligence/sparql.txt -o "../bsbm.businessIntelligence.rudf.${DATASET_SIZE}.${MEMORY_SIZE}.$(date +'%Y-%m-%d').xml" http://localhost:7878/query kill $! rm -r rudf_data rm "explore-${DATASET_SIZE}.nt" diff --git a/bench/bsbm_virtuoso.sh b/bench/bsbm_virtuoso.sh index 88734e2c..6dade7eb 100755 --- a/bench/bsbm_virtuoso.sh +++ b/bench/bsbm_virtuoso.sh @@ -6,9 +6,12 @@ cd bsbm-tools cp ../virtuoso-opensource/database/virtuoso.ini.sample virtuoso.ini mkdir ../database ../virtuoso-opensource/bin/virtuoso-t -f & -sleep 30 -curl -f --digest --user dba:dba -H 'Content-Type:application/n-triples' --data-binary "@explore-${DATASET_SIZE}.nt" 'http://localhost:8890/sparql-graph-crud-auth?graph-uri=urn:graph:test' -curl -f -H 'Content-Type:application/sparql-query' --data "SELECT (COUNT(*) AS ?c) WHERE { ?s ?p ?o }" 'http://localhost:8890/sparql?graph-uri=urn:graph:test' +sleep 10 +../virtuoso-opensource/bin/isql 1111 dba dba <; +ld_dir('$(realpath .)', 'explore-${DATASET_SIZE}.nt', 'urn:graph:test'); +rdf_loader_run(); +EOF ./testdriver -ucf usecases/explore/sparql.txt -o "../bsbm.explore.virtuoso.${DATASET_SIZE}.7.2.5.xml" 'http://localhost:8890/sparql?graph-uri=urn:graph:test' ./testdriver -ucf usecases/businessIntelligence/sparql.txt -o "../bsbm.businessIntelligence.virtuoso.${DATASET_SIZE}.7.2.5.xml" 'http://localhost:8890/sparql?graph-uri=urn:graph:test' kill $!