Skip to content

Commit

Permalink
Adding API Server, Client and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Akshath Karanam committed Apr 27, 2023
1 parent be64dcd commit 0798450
Show file tree
Hide file tree
Showing 11 changed files with 5,086 additions and 51 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions API Server
Submodule API Server added at 2add91
64 changes: 64 additions & 0 deletions Client/visualize.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>Embedding Vega-Lite</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
</head>
<body>
<div id="chart"></div>

<script type="text/javascript">
var vlSpec = {
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"concat": [{
"title": "Geometric mean of WASM engines",
"height": 650,
"width": 1000,
"data": {name: 'dbData'},
"transform": [{"filter": {"param": "suite"}}, {"filter": {"param": "metric"}}],
"encoding": {
"x": {"field": "Date", "type": "temporal", "title": "Year 2022"},
"y": {"aggregate": "mean", "field": "Value", "type": "quantitative", "title": "Metric Value"},
"color": {
"field": "Engine"
}
},
"layer": [{"mark": "line"},
{ "params": [{
"name": "suite",
"select": {"type": "point", "fields": ["Suite"]},
"bind": {"name": "Suite","input": "select", "options": ["PolybenchC", "Others"]}
},{
"name": "window",
"select": {"type": "interval", "encodings": ["x"]
}},
{
"name": "metric",
"select": {"type": "point", "fields": ["MetricType"]},
"bind": {"name": "MetricType","input": "select", "options": ["execution_time", "Others"]}
}],
"mark": {"type": "circle", "tooltip": true},
"encoding": {
"opacity": {
"value": 1
},
"size": {
"value": 30
}
}
}]
}]
};
vegaEmbed('#chart', vlSpec).then(function (res) {
async function logJSONData() {
var response = await fetch("http://localhost:6363/get_all_mean");
var jsonData = await response.json();
res.view.insert('dbData', jsonData.data).run();
}
logJSONData();
});
</script>
</body>
</html>
40 changes: 40 additions & 0 deletions DBQueries.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
1. Granular view #1 - Display all geomean
SELECT
exp_date, benchmark_suite, benchmark_item, engine, version, config,
machine, metric_type, avg FROM summary
WHERE
exp_label = 'NIGHTLYRUN' AND benchmark_item = "GEOMEAN"


2. Fine view #2 - show for all selected data range
SELECT
exp_date, benchmark_suite, benchmark_item, engine, version, config,
machine, metric_type, avg FROM summary
WHERE
exp_data BETWEEN value1 AND value2 AND exp_label = 'NIGHTLYRUN' AND benchmark_item != "GEOMEAN"


3. Fine view #3 - show violin plot for one DATE and one benchmark suite
SELECT
percentile_95,
min,
max,
metric_type,
engine,
version,
config,
machine,
WHERE
exp_data = value1 AND exp_label = 'NIGHTLYRUN' AND benchmark_suite = value2 AND benchmark_item != "GEOMEAN"


Note: The API Server currently has slightly modified queries, since the database does not have "GEOMEAN" values yet.
"GEOMEAN" is a tag assigned to "benchmark_item" column in the SUMMARY table, to store the geometric mean for each
engine + config across all "benchmark_item" in a "benchmark_suite".

Once the geometric mean values are added to the database, with the corresponding "benchmark_item" column storing string
"GEOMEAN", the API queries should be replaced with the above mentioned queries.




41 changes: 41 additions & 0 deletions DBSchema.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
PostgresQL DB Schema for WASM benchmarking

1. Create a database 'wasm_benchmark' on PostgresQL

2. Create a summary table using the following syntax
CREATE TABLE summary (
exp_date DATE NOT NULL DEFAULT CURRENT_DATE,
exp_label VARCHAR NOT NULL,
benchmark_suite VARCHAR(100) NOT NULL,
benchmark_item VARCHAR(100) NOT NULL,
engine VARCHAR(100) NOT NULL,
version VARCHAR(100) NOT NULL,
config VARCHAR(40) NOT NULL,
machine VARCHAR(25) NOT NULL,
metric_type metric NOT NULL,
avg NUMERIC(10,7) NOT NULL,
percentile_5 NUMERIC(10,7) NOT NULL,
percentile_95 NUMERIC(10,7) NOT NULL,
min NUMERIC(10,7) NOT NULL,
max NUMERIC(10,7) NOT NULL,
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
)

3. Create a raw data table with the following syntax
CREATE TABLE raw (
exp_date DATE NOT NULL DEFAULT CURRENT_DATE,
exp_label VARCHAR NOT NULL,
benchmark_suite VARCHAR(100) NOT NULL,
benchmark_item VARCHAR(100) NOT NULL,
engine VARCHAR(100) NOT NULL,
version VARCHAR(100) NOT NULL,
config VARCHAR(40) NOT NULL,
machine VARCHAR(25) NOT NULL,
execution_samples NUMERIC(10,7)[] NOT NULL,
memory_samples NUMERIC(10,7)[] NOT NULL,
preprocess_samples NUMERIC(10,7)[] NOT NULL,
aot_samples NUMERIC(10,7)[] NOT NULL,
jit_samples NUMERIC(10,7)[] NOT NULL,
time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
)

37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# wish-you-were-fast

Wish-you-were-fast is a real-time wasm benchmarking + visualization plaftorm. This README attempts to explain the
various directories and the parts of the platform they represent.

* API Server

Hosts a Flask Server acting as an API Gateway microservice between the WASM visualization frontend and
the PostgresQL database (storing the benchmarking results). Currently, the API Server provides 3 REST APIs necessary to provide the initial 3 views of the frontend visualization. It receives request parameters from the
frontend service, queries the database, parses it and returns a JSON result containing the requested data.

* Client

Provides a barebones html file which hosts the vegalite-based visualizations. Easiest way to get this running locally is to go to the directory on cmdline and start a http server using
"python -m http.server". The visualization would then be available on localhost:8000/visualize.html.

Note: The visualization currently provides only the first view. While the API Server supports the necessary APIs for all 3 views, we are yet to figure out how an interactive datarange
on the first vegalite view (i.e the x-axis select interval) can be converted from vegalite object to a dynamic REST API parameter. Once done, the remaining 2 views can be impleted similar to the multiview-exec.vl.json specification in the vegalite folder.

* historical-data

Contains raw data for each of the 6 engines on PolyBenchC for a 6 month duration from Sept '22 to Feb '23, sampled at a monthly interval. Also contains a consolidated csv which can be used to load data directly to the PostgresQL database.

* vegalite

Contains examples and test-scripts for visualizing and learning vegalite

* DBSchema.txt

Lays down the DB schema to create the PostgresQL database

* DBQueries.txt

Documents the queries required to create the 3 initial vegalite views




Binary file added historical-data/.DS_Store
Binary file not shown.
Loading

0 comments on commit 0798450

Please sign in to comment.