https://github.com/comunica/comunica-bencher
🏋 A tool for easily running reproducible benchmarks with Comunica
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: springer.com -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Repository
🏋 A tool for easily running reproducible benchmarks with Comunica
Basic Info
Statistics
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Comunica Bencher
This tool is deprecated in favor of jbr
A tool for easily creating and running benchmarks with Comunica and LDF Server.
Experiments that are created and executed with this tool are fully reproducible, as experiments are fully deterministic, and metadata on all exact installed dependency versions is emitted together with the results.
Together with the (semantic) configuration files of Comunica and LDF Server, this tool completes the whole provenance chain of experimental results:
- Setup of sofware based on configuration
- Generating experiment input data
- Execution of experiments based on parameters
- Description of environment dependencies during experiments
- Reporting of results
- Archiving results into a single file for easy exchange
Requirements
- Bash (Installed by default on UNIX machines)
- Docker
- docker-compose
Install
Automatically
This will automatically clone this repo into $HOME/.comunica-bencher (requires git),
and adds this tool to your $PATH.
bash
$ sh -c "`curl -fsSl https://raw.githubusercontent.com/comunica/comunica-bencher/master/install.sh`"
If you want to uninstall later, just remove $HOME/.comunica-bencher and the $PATH modification in ~/.bashrc.
Manually
First, clone this repo somewhere:
bash
$ git clone git@github.com:comunica/comunica-bencher.git
Then, add the /bin folder to your $PATH.
For example, by adding the following to your ~/.bashrc
bash
export PATH="/path/to/comunica-bencher/bin:$PATH"
Usage
This tool offers commands for executing the whole experimentation chain:
- Initialization: Create a new experiment. This should be done only once.
- Data Preparation: Generating a dataset and query set. This should be done only once.
- Running Experiments: Starting the required machines and running the benchmark.
- Results Analysis: Generating plots and outputting data for result analysis.
1. Initialization
bash
$ comunica-bencher init <my-experiment-name>
Running this command will create a new directory with the given name. This directory will contain all default required files for running an experiment. You can initialize this directory as a git repository.
In most cases, you will only need to edit the .env file to configure your experiment.
2. Data Preparation
bash
$ comunica-bencher prepare-data
This command will automatically generate a dataset and query set using WatDiv, and convert the dataset to HDT.
It will generate the following output:
* input/dataset.hdt: An HDT file that was created from the generated WatDiv dataset.
* input/dataset.hdt.index.v1-1: A corresponding HDT index file.
* input/queries/: A folder containing queries.
3. Running Experiments
bash
$ comunica-bencher run-local
This command will start the following:
* LDF server based on the config in input/server-config.json (and dataset input/dataset.hdt).
* NGINX cache in front of the LDF server based on the config from input/nginx.conf and input/nginx-default.
* Comunica engine as SPARQL endpoint, based on the Comunica engine config in input/client-config.json.
* Benchmark runner that will execute the queries from input/queries.
Once the benchmark runner is done, the following files will be available:
* output/queries.csv: Query execution time and number of results for all queries.
* output/stats-client.csv: CPU usage, Memory usage and I/O for the client.
* output/stats-server.csv: CPU usage, Memory usage and I/O for the server.
* output/stats-server-cache.csv: CPU usage, Memory usage and I/O for the server cache.
* output/cache-logs/access.log: NGINX access log files (including cache HIT/MISS details).
* output/cache-logs/error.log: NGINX error log files.
* output/dependencies-client.ttl: An RDF representation of all dependencies that were available in the client.
* output/dependencies-server.ttl: An RDF representation of all dependencies that were available in the server.
4. Results Analysis
This tool offers a few commands to analyze and plot the experiment results:
Plot query execution times
bash
$ comunica-bencher plot queries [experiment1 [experiment2 [...]]]
This command will create a vectorial CSV-based (LaTeX/TiKZ) plot that compares the query execution times over all given experiments. This is useful for comparing different approaches with each other.
Concretely, it will output the plot_queries_data.csv and plot_queries_data.tex files.
These can be included in a LaTeX document, or converted to other formats like SVG and PDF.
Plot options
The following options may be provided to customize the plots.
Options always have to be defined before the experiment names.
| Option | Description |
| ---------------------- | ----------- |
| -q regex | Regex for queries to include. Examples: '^C', '^[^C]', ... |
| -n name | Custom output file name. Default: 'plot_queries_data' |
| -c name | Color scheme name from colorbrewer2.org. Default 'Spectral-<n>' |
| --max-y value | The upper limit of the Y-axis. Defaults to maximum Y value |
| --no-legend | If the legend should be excluded from the plot. |
| --legend-pos pos | The legend position X,Y (anchor north-east). Default: '1.0,1.0' |
| --log-y | If the Y-axis should have a log scale. |
Summarize all execution times
bash
$ comunica-bencher plot queries_all [experiment1 [experiment2 [...]]]
This command will generate a single CSV file with all query execution results with their corresponding combination id. This is useful for executing statistical tests on the results with tools such as R.
Concretely, it will output the data_all.csv that looks as follows:
csv
combination;time
combination_0;10963
combination_0;10849
combination_0;11912
combination_1;16320
combination_1;12389
combination_1;11944
You can for example use this data to calculate the statistical different between two combinations in R as follows: ```R data <- read.csv('./data_all.csv', sep = ';')
Calculate means
aggregate(data$time, list(data$combination), median)
Compare means with Kruskal-Wallis test (nonparametric, if non-normal distribution)
kruskal.test(time ~ combination, data = data[which(data$combination=='combination0' | data$combination=='combination1'),])
If p < 0.05, combinations have no difference with a significance of 95%.
If p > 0.05, combinations are different with a significance of 95%.
```
Plot options
The following options may be provided to customize the plots.
Options always have to be defined before the experiment names.
| Option | Description |
| ---------------------- | ----------- |
| -q regex | Regex for queries to include. Examples: '^C', '^[^C]', ... |
| -n name | Custom output file name. Default: 'data_all' |
Plot query result arrival times
bash
$ comunica-bencher plot query_times <query> [experiment1 [experiment2 [...]]]
This command will create a vectorial CSV-based (LaTeX/TiKZ) plot that compares the Diefficiency Metric values for all queries in the given experiments. This is useful for comparing the impact of different approaches on query result arrival times.
Higher values mean that results come in at a faster rate.
Concretely, it will output the dief_time.csv and dief_time.tex files.
These can be included in a LaTeX document, or converted to other formats like SVG and PDF.
Plot options
The following options may be provided to customize the plots.
Options always have to be defined before the experiment names.
| Option | Description |
| ---------------------- | ----------- |
| -n name | Custom output file name. Default: 'query_times_<query>' |
| -c name | Color scheme name from colorbrewer2.org. Default 'Spectral-<n>' |
| --max-y value | The upper limit of the Y-axis. Defaults to maximum Y value |
| --no-legend | If the legend should be excluded from the plot. |
| --log-y | If the Y-axis should have a log scale. |
Plot diefficiency values
bash
$ comunica-bencher plot dief time [experiment1 [experiment2 [...]]]
This command will create a vectorial CSV-based (LaTeX/TiKZ) plot that compares compares the query result arrival times over all given experiments. This is useful for comparing the impact of different approaches on query result arrival times.
Concretely, it will output the query_times_<query>.csv and query_times_<query>.tex files.
These can be included in a LaTeX document, or converted to other formats like SVG and PDF.
Plot options
The following options may be provided to customize the plots.
Options always have to be defined before the experiment names.
| Option | Description |
| ---------------------- | ----------- |
| -q regex | Regex for queries to include. Examples: '^C', '^[^C]', ... |
| -n name | Custom output file name. Default: 'query_times_<query>' |
| -c name | Color scheme name from colorbrewer2.org. Default 'Spectral-<n>' |
| --max-y value | The upper limit of the Y-axis. Defaults to maximum Y value |
| --no-legend | If the legend should be excluded from the plot. |
| --legend-pos pos | The legend position X,Y (anchor north-east). Default: '1.0,1.0' |
| --log-y | If the Y-axis should have a log scale. |
Calculate stats
bash
$ comunica-bencher plot stats <action> experiment
This command allows you to calculate the following statistics over your results:
| Action | Description |
| ---------------------- | ----------- |
| all | Print a summary of all results |
| cpu-server | Print the server's average CPU load (%) |
| cpu-server-cache | Print the cache server's average CPU load (%) |
| cpu-client | Print the client's average CPU load (%) |
| mem-server | Print the server's average memory usage (%) |
| mem-server-cache | Print the cache server's average memory usage (%) |
| mem-client | Print the client's average memory usage (%) |
| io-server | Print the server's total network interface input/output amount |
| io-server-cache | Print the cache server's total network interface input/output amount |
| io-client | Print the client's total network interface input/output amount |
For example, comunica-bencher plot stats all experiment could output the following
Stats summary:
Server CPU: 10.33%
Server cache CPU: 4.66%
Client CPU: 97.37%
Server mem: 3.17%
Server cache mem: 2.25%
Client mem: 6.24%
Server I/O: 10.7MB / 54.3MB
Server cache I/O: 64.5MB / 89MB
Client I/O: 78.7MB / 11.2MB
Diefficiency Metrics
bash
$ comunica-bencher dief time [experiment1 [experiment2 [...]]]
Thiss command will output the Diefficiency Metrics for the given expirements. The output is returned on stdout in csv format so can be piped to a file if required.
Optional: exchanging results
If you are running experiments on a remote server, but you want to analyze the results locally, it is useful to download the experiment results from that server.
Using the following command, you can create a single TAR archive from your experiment results, so that it can be downloaded easily to your local machine.
bash
$ comunica-bencher collect
This TAR file only includes the required output files, so no unneeded experiment input files will be downloaded.
Configurability
With the .env file, you can configure your benchmark.
The following options are available:
| Key | Description |
| ---------------------- | ----------- |
| DATASET_SCALE | The WatDiv dataset scale (1 ~= 100K triples). |
| QUERY_COUNT | The number of queries per category in WatDiv. |
| QUERIES | A folder containing queries to execute. |
| REPLICATION | The number of times the queries should be executed and averaged over. |
| WARMUP_ROUNDS | The number of times the queries should be executed as a warmup. |
| SERVER_DATASET | Path to an HDT file that will be loaded in the server as dataset. |
| SERVER_CONFIG | Path to an LDF server config file. |
| SERVER_WORKERS | The number of workers the LDF server will have. |
| CLIENTS | The number of concurrent clients. |
| CLIENT_CONFIG | Path to a Comunica config file. |
| CLIENT_QUERY_SOURCES | Path to a JSON config file containing Comunica context, containing the sources that need to be queried. |
| CLIENT_TIMEOUT | The query timeout in seconds. |
By default, the Comunica engine will query the server cache at http://server-cache:80/dataset.
If you want to skip this cache, you can set the source in input/client-sources.json to http://server:3000/dataset instead.
If you want change more fundamental this to your experiment,
you can change the following files:
* docker-compose.yml: Instantiation of multiple services for your experiment.
* dockerfiles/: Dockerfiles for the different services that are described in docker-compose.yml. These will be built on each experiment run.
* input/client-config: The Comunica config file.
* input/client-sources.json: The context containing the list of sources that Comunica should query with.
* input/nginx.conf, input/nginx-default: NGINX configuration with a default rate limit of 1MB/s.
* server-config.json: LDF server config file.
Advanced: Matrix Combinations
If you need to compare a large number of combinations over many factors, it may be useful to automatically generate separate experiments for each possible combination.
This tool allows you to define a parameterized template experiment, and can generate all possible variants of this template as separate experiments.
Note: this requires Node.js
This can be done as follows:
- Generate a template experiment:
comunica-bencher init-matrix my-matrix-experiments(and runcd my-matrix-experiments). - Define a matrix of combinations by filling in
matrix-values.json. - Initialize data and combinations by running
comunica-bencher prepare-data. - Run all combinations sequentually by running
comunica-bencher run-local.
Ideally, you should only commit the template experiment to a git repo. The matrix combinations can be generated deterministically after cloning.
Defining a matrix
matrix-values.json is a JSON file containing all factors that need to be combined.
This must contain an object with factor names, and arrays as values.
Each value can either by a string or a number.
For example:
json
{
"MATRIX_SERVER_WORKERS": [1, 2],
"MATRIX_SERVER_TITLE": ["My title 1","My title 2"]
}
template must be a valid experiment where files can be parameterized with %PARAMETER_NAME% references.
For example, an .env file could contain the following:
``` EXPERIMENTNAME=template%MATRIX_ID%
SERVERDATASET=./input/dataset.hdt SERVERCONFIG=./input/server-config.json SERVERWORKERS=%MATRIXSERVER_WORKERS% ```
`%MATRIXID%will automatically contain the current combination ID, and%MATRIXEXPERIMENTNAME%` will automatically contain the current experiment name._
Optional: Override matrix combination names
Optionally, you can override the names of each combination in a matrix-names.json file.
Custom combination names will be used in graph legends when generating plots.
A matrix-names.json file can look as follows:
json
[
"A-Fast-Algorithm",
"Another-Fast-Algorithm",
"A-Slow-Algorithm",
"A-Very-Slow-Algorithm",
]
The contents of this file must always be an array, and the length of this array must correspond to the total number of combinations of the matrix.
Note: Names can not contain special characters or spaces.
Generating combinations manually
By running the following command, the matrix combinations will be generated directly without preparing the data.
bash
$ comunica-bencher gen-matrix
This will generate the experiments combination_1, combination_2, combination_3, ..., combination_n.
With n being the total number of combinations.
License
This code is copyrighted by Ghent University – imec and released under the MIT license.
Owner
- Name: Comunica
- Login: comunica
- Kind: organization
- Location: Ghent, Belgium
- Website: https://comunica.dev
- Twitter: comunicajs
- Repositories: 69
- Profile: https://github.com/comunica
Flexible SPARQL and GraphQL over decentralized RDF on the Web.
GitHub Events
Total
Last Year
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ruben Taelman | r****n@u****e | 87 |
| Joachim Van Herwegen | j****h@g****m | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 1
- Total pull requests: 2
- Average time to close issues: about 2 months
- Average time to close pull requests: about 14 hours
- Total issue authors: 1
- Total pull request authors: 1
- Average comments per issue: 1.0
- Average comments per pull request: 0.5
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- rubensworks (1)
Pull Request Authors
- joachimvh (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- comunica-bencher-cache ${EXPERIMENT_NAME}
- comunica-bencher-client ${EXPERIMENT_NAME}
- comunica-bencher-runner ${EXPERIMENT_NAME}
- comunica-bencher-server ${EXPERIMENT_NAME}