Skip to content

Commit 5830420

Browse files
committed
Add benchmarks for querying Vortex files with datafusion
1 parent bd95023 commit 5830420

File tree

5 files changed

+231
-0
lines changed

5 files changed

+231
-0
lines changed

datafusion-vortex/benchmark.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Install Rust
6+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rust-init.sh
7+
bash rust-init.sh -y
8+
source ~/.cargo/env
9+
10+
# Install Dependencies
11+
sudo apt-get update
12+
sudo apt-get install --yes gcc jq build-essential
13+
14+
# Install Vortex from latest release main branch
15+
git clone https://github.com/spiraldb/vortex.git || true
16+
cd vortex
17+
git checkout 0.34.0
18+
git submodule update --init
19+
# We build a release version of the benchmarking utility using mimalloc, just like the datafusion-cli
20+
cargo build --release --bin clickbench --package bench-vortex
21+
export PATH="`pwd`/target/release:$PATH"
22+
cd ..
23+
24+
# Vortex's benchmarking utility generates appropriate Vortex files by itself, so we just run it to make sure they exist before we start measuring.
25+
# This will download parquet files (with time and string columns already converted to the logically correct datatype) and generate Vortex files from them.
26+
clickbench -i 1 --targets datafusion:vortex --display-format gh-json -q 0 --hide-progress-bar --flavor single
27+
clickbench -i 1 --targets datafusion:vortex --display-format gh-json -q 0 --hide-progress-bar --flavor partitioned
28+
29+
# Run benchmarks for single parquet and partitioned, our CLI generates the relevant vortex files.
30+
./run.sh single
31+
./run.sh partitioned
32+

datafusion-vortex/queries.sql

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
SELECT COUNT(*) FROM hits;
2+
SELECT COUNT(*) FROM hits WHERE "AdvEngineID" <> 0;
3+
SELECT SUM("AdvEngineID"), COUNT(*), AVG("ResolutionWidth") FROM hits;
4+
SELECT AVG("UserID") FROM hits;
5+
SELECT COUNT(DISTINCT "UserID") FROM hits;
6+
SELECT COUNT(DISTINCT "SearchPhrase") FROM hits;
7+
SELECT MIN("EventDate"), MAX("EventDate") FROM hits;
8+
SELECT "AdvEngineID", COUNT(*) FROM hits WHERE "AdvEngineID" <> 0 GROUP BY "AdvEngineID" ORDER BY COUNT(*) DESC;
9+
SELECT "RegionID", COUNT(DISTINCT "UserID") AS u FROM hits GROUP BY "RegionID" ORDER BY u DESC LIMIT 10;
10+
SELECT "RegionID", SUM("AdvEngineID"), COUNT(*) AS c, AVG("ResolutionWidth"), COUNT(DISTINCT "UserID") FROM hits GROUP BY "RegionID" ORDER BY c DESC LIMIT 10;
11+
SELECT "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE "MobilePhoneModel" <> '' GROUP BY "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
12+
SELECT "MobilePhone", "MobilePhoneModel", COUNT(DISTINCT "UserID") AS u FROM hits WHERE "MobilePhoneModel" <> '' GROUP BY "MobilePhone", "MobilePhoneModel" ORDER BY u DESC LIMIT 10;
13+
SELECT "SearchPhrase", COUNT(*) AS c FROM hits WHERE "SearchPhrase" <> '' GROUP BY "SearchPhrase" ORDER BY c DESC LIMIT 10;
14+
SELECT "SearchPhrase", COUNT(DISTINCT "UserID") AS u FROM hits WHERE "SearchPhrase" <> '' GROUP BY "SearchPhrase" ORDER BY u DESC LIMIT 10;
15+
SELECT "SearchEngineID", "SearchPhrase", COUNT(*) AS c FROM hits WHERE "SearchPhrase" <> '' GROUP BY "SearchEngineID", "SearchPhrase" ORDER BY c DESC LIMIT 10;
16+
SELECT "UserID", COUNT(*) FROM hits GROUP BY "UserID" ORDER BY COUNT(*) DESC LIMIT 10;
17+
SELECT "UserID", "SearchPhrase", COUNT(*) FROM hits GROUP BY "UserID", "SearchPhrase" ORDER BY COUNT(*) DESC LIMIT 10;
18+
SELECT "UserID", "SearchPhrase", COUNT(*) FROM hits GROUP BY "UserID", "SearchPhrase" LIMIT 10;
19+
SELECT "UserID", extract(minute FROM "EventTime") AS m, "SearchPhrase", COUNT(*) FROM hits GROUP BY "UserID", m, "SearchPhrase" ORDER BY COUNT(*) DESC LIMIT 10;
20+
SELECT "UserID" FROM hits WHERE "UserID" = 435090932899640449;
21+
SELECT COUNT(*) FROM hits WHERE "URL" LIKE '%google%';
22+
SELECT "SearchPhrase", MIN("URL"), COUNT(*) AS c FROM hits WHERE "URL" LIKE '%google%' AND "SearchPhrase" <> '' GROUP BY "SearchPhrase" ORDER BY c DESC LIMIT 10;
23+
SELECT "SearchPhrase", MIN("URL"), MIN("Title"), COUNT(*) AS c, COUNT(DISTINCT "UserID") FROM hits WHERE "Title" LIKE '%Google%' AND "URL" NOT LIKE '%.google.%' AND "SearchPhrase" <> '' GROUP BY "SearchPhrase" ORDER BY c DESC LIMIT 10;
24+
SELECT * FROM hits WHERE "URL" LIKE '%google%' ORDER BY "EventTime" LIMIT 10;
25+
SELECT "SearchPhrase" FROM hits WHERE "SearchPhrase" <> '' ORDER BY "EventTime" LIMIT 10;
26+
SELECT "SearchPhrase" FROM hits WHERE "SearchPhrase" <> '' ORDER BY "SearchPhrase" LIMIT 10;
27+
SELECT "SearchPhrase" FROM hits WHERE "SearchPhrase" <> '' ORDER BY "EventTime", "SearchPhrase" LIMIT 10;
28+
SELECT "CounterID", AVG(length("URL")) AS l, COUNT(*) AS c FROM hits WHERE "URL" <> '' GROUP BY "CounterID" HAVING COUNT(*) > 100000 ORDER BY l DESC LIMIT 25;
29+
SELECT REGEXP_REPLACE("Referer", '^https?://(?:www\.)?([^/]+)/.*$', '\1') AS k, AVG(length("Referer")) AS l, COUNT(*) AS c, MIN("Referer") FROM hits WHERE "Referer" <> '' GROUP BY k HAVING COUNT(*) > 100000 ORDER BY l DESC LIMIT 25;
30+
SELECT SUM("ResolutionWidth"), SUM("ResolutionWidth" + 1), SUM("ResolutionWidth" + 2), SUM("ResolutionWidth" + 3), SUM("ResolutionWidth" + 4), SUM("ResolutionWidth" + 5), SUM("ResolutionWidth" + 6), SUM("ResolutionWidth" + 7), SUM("ResolutionWidth" + 8), SUM("ResolutionWidth" + 9), SUM("ResolutionWidth" + 10), SUM("ResolutionWidth" + 11), SUM("ResolutionWidth" + 12), SUM("ResolutionWidth" + 13), SUM("ResolutionWidth" + 14), SUM("ResolutionWidth" + 15), SUM("ResolutionWidth" + 16), SUM("ResolutionWidth" + 17), SUM("ResolutionWidth" + 18), SUM("ResolutionWidth" + 19), SUM("ResolutionWidth" + 20), SUM("ResolutionWidth" + 21), SUM("ResolutionWidth" + 22), SUM("ResolutionWidth" + 23), SUM("ResolutionWidth" + 24), SUM("ResolutionWidth" + 25), SUM("ResolutionWidth" + 26), SUM("ResolutionWidth" + 27), SUM("ResolutionWidth" + 28), SUM("ResolutionWidth" + 29), SUM("ResolutionWidth" + 30), SUM("ResolutionWidth" + 31), SUM("ResolutionWidth" + 32), SUM("ResolutionWidth" + 33), SUM("ResolutionWidth" + 34), SUM("ResolutionWidth" + 35), SUM("ResolutionWidth" + 36), SUM("ResolutionWidth" + 37), SUM("ResolutionWidth" + 38), SUM("ResolutionWidth" + 39), SUM("ResolutionWidth" + 40), SUM("ResolutionWidth" + 41), SUM("ResolutionWidth" + 42), SUM("ResolutionWidth" + 43), SUM("ResolutionWidth" + 44), SUM("ResolutionWidth" + 45), SUM("ResolutionWidth" + 46), SUM("ResolutionWidth" + 47), SUM("ResolutionWidth" + 48), SUM("ResolutionWidth" + 49), SUM("ResolutionWidth" + 50), SUM("ResolutionWidth" + 51), SUM("ResolutionWidth" + 52), SUM("ResolutionWidth" + 53), SUM("ResolutionWidth" + 54), SUM("ResolutionWidth" + 55), SUM("ResolutionWidth" + 56), SUM("ResolutionWidth" + 57), SUM("ResolutionWidth" + 58), SUM("ResolutionWidth" + 59), SUM("ResolutionWidth" + 60), SUM("ResolutionWidth" + 61), SUM("ResolutionWidth" + 62), SUM("ResolutionWidth" + 63), SUM("ResolutionWidth" + 64), SUM("ResolutionWidth" + 65), SUM("ResolutionWidth" + 66), SUM("ResolutionWidth" + 67), SUM("ResolutionWidth" + 68), SUM("ResolutionWidth" + 69), SUM("ResolutionWidth" + 70), SUM("ResolutionWidth" + 71), SUM("ResolutionWidth" + 72), SUM("ResolutionWidth" + 73), SUM("ResolutionWidth" + 74), SUM("ResolutionWidth" + 75), SUM("ResolutionWidth" + 76), SUM("ResolutionWidth" + 77), SUM("ResolutionWidth" + 78), SUM("ResolutionWidth" + 79), SUM("ResolutionWidth" + 80), SUM("ResolutionWidth" + 81), SUM("ResolutionWidth" + 82), SUM("ResolutionWidth" + 83), SUM("ResolutionWidth" + 84), SUM("ResolutionWidth" + 85), SUM("ResolutionWidth" + 86), SUM("ResolutionWidth" + 87), SUM("ResolutionWidth" + 88), SUM("ResolutionWidth" + 89) FROM hits;
31+
SELECT "SearchEngineID", "ClientIP", COUNT(*) AS c, SUM("IsRefresh"), AVG("ResolutionWidth") FROM hits WHERE "SearchPhrase" <> '' GROUP BY "SearchEngineID", "ClientIP" ORDER BY c DESC LIMIT 10;
32+
SELECT "WatchID", "ClientIP", COUNT(*) AS c, SUM("IsRefresh"), AVG("ResolutionWidth") FROM hits WHERE "SearchPhrase" <> '' GROUP BY "WatchID", "ClientIP" ORDER BY c DESC LIMIT 10;
33+
SELECT "WatchID", "ClientIP", COUNT(*) AS c, SUM("IsRefresh"), AVG("ResolutionWidth") FROM hits GROUP BY "WatchID", "ClientIP" ORDER BY c DESC LIMIT 10;
34+
SELECT "URL", COUNT(*) AS c FROM hits GROUP BY "URL" ORDER BY c DESC LIMIT 10;
35+
SELECT 1, "URL", COUNT(*) AS c FROM hits GROUP BY 1, "URL" ORDER BY c DESC LIMIT 10;
36+
SELECT "ClientIP", "ClientIP" - 1, "ClientIP" - 2, "ClientIP" - 3, COUNT(*) AS c FROM hits GROUP BY "ClientIP", "ClientIP" - 1, "ClientIP" - 2, "ClientIP" - 3 ORDER BY c DESC LIMIT 10;
37+
SELECT "URL", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "DontCountHits" = 0 AND "IsRefresh" = 0 AND "URL" <> '' GROUP BY "URL" ORDER BY PageViews DESC LIMIT 10;
38+
SELECT "Title", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "DontCountHits" = 0 AND "IsRefresh" = 0 AND "Title" <> '' GROUP BY "Title" ORDER BY PageViews DESC LIMIT 10;
39+
SELECT "URL", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "IsRefresh" = 0 AND "IsLink" <> 0 AND "IsDownload" = 0 GROUP BY "URL" ORDER BY PageViews DESC LIMIT 10 OFFSET 1000;
40+
SELECT "TraficSourceID", "SearchEngineID", "AdvEngineID", CASE WHEN ("SearchEngineID" = 0 AND "AdvEngineID" = 0) THEN "Referer" ELSE '' END AS Src, "URL" AS Dst, COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "IsRefresh" = 0 GROUP BY "TraficSourceID", "SearchEngineID", "AdvEngineID", Src, Dst ORDER BY PageViews DESC LIMIT 10 OFFSET 1000;
41+
SELECT "URLHash", "EventDate", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "IsRefresh" = 0 AND "TraficSourceID" IN (-1, 6) AND "RefererHash" = 3594120000172545465 GROUP BY "URLHash", "EventDate" ORDER BY PageViews DESC LIMIT 10 OFFSET 100;
42+
SELECT "WindowClientWidth", "WindowClientHeight", COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-01' AND "EventDate" <= '2013-07-31' AND "IsRefresh" = 0 AND "DontCountHits" = 0 AND "URLHash" = 2868770270353813622 GROUP BY "WindowClientWidth", "WindowClientHeight" ORDER BY PageViews DESC LIMIT 10 OFFSET 10000;
43+
SELECT DATE_TRUNC('minute', "EventTime") AS M, COUNT(*) AS PageViews FROM hits WHERE "CounterID" = 62 AND "EventDate" >= '2013-07-14' AND "EventDate" <= '2013-07-15' AND "IsRefresh" = 0 AND "DontCountHits" = 0 GROUP BY DATE_TRUNC('minute', "EventTime") ORDER BY DATE_TRUNC('minute', M) LIMIT 10 OFFSET 1000;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"system": "DataFusion (Vortex, partitioned)",
3+
"date": "2024-04-17",
4+
"machine": "c6a.4xlarge, 500gb gp2",
5+
"cluster_size": 1,
6+
"comment": "v46.0.0 (d5ca830) - Vortex 0.31 (b55e5e)",
7+
"tags": ["Rust", "column-oriented", "embedded", "stateless"],
8+
"load_time": 0,
9+
"data_size": 17429875344,
10+
"result": [
11+
[0.195474279, 0.034570003, 0.034026222],
12+
[0.246191515, 0.041141916, 0.044848817],
13+
[0.29584558, 0.1020283, 0.090089468],
14+
[0.864017237, 0.136731143, 0.141933835],
15+
[1.330174832, 0.817954813, 0.82542611],
16+
[1.39255349, 0.871064898, 0.885390795],
17+
[0.168982081, 0.034338712, 0.035661602],
18+
[0.214936859, 0.049426444, 0.046771656],
19+
[1.741988228, 1.017005351, 1.005980233],
20+
[2.085537543, 1.060258473, 1.046343931],
21+
[0.973279501, 0.176568409, 0.173643253],
22+
[1.0506882, 0.19012763, 0.190939948],
23+
[1.547443006, 0.753253044, 0.739890005],
24+
[3.079241046, 1.219360407, 1.23579715],
25+
[1.567949092, 0.637838632, 0.645707723],
26+
[1.236257717, 0.987361773, 0.994513731],
27+
[3.257291143, 1.976759837, 1.94962027],
28+
[3.082905656, 1.924771694, 1.934466144],
29+
[4.8261405, 3.437983572, 3.492944472],
30+
[0.441434871, 0.074981438, 0.076566163],
31+
[13.690912104, 0.610733654, 0.619538621],
32+
[14.710127276, 0.683421256, 0.689444956],
33+
[17.798516681, 1.114766581, 1.094076615],
34+
[49.191114128, 2.33388445, 2.310107578],
35+
[2.106869344, 0.248940377, 0.242400316],
36+
[1.195640891, 0.304528521, 0.316663257],
37+
[2.123475097, 0.287461268, 0.290783726],
38+
[13.523388543, 1.239699578, 1.241615961],
39+
[12.257366834, 9.443642153, 9.064860562],
40+
[0.784893362, 0.541128274, 0.569927227],
41+
[2.685793073, 0.546619483, 0.54423194],
42+
[5.787000344, 0.672136167, 0.628199639],
43+
[4.556871955, 3.519229704, 3.546459582],
44+
[13.683006809, 3.491344267, 3.477255937],
45+
[13.779567705, 3.464400107, 3.505931201],
46+
[1.602064284, 1.394167035, 1.407970413],
47+
[0.323534632, 0.13950815, 0.128747237],
48+
[0.249197438, 0.06739744, 0.076000544],
49+
[0.246336888, 0.066967224, 0.059371319],
50+
[0.411601267, 0.228601967, 0.230812179],
51+
[0.225248326, 0.056891852, 0.05051897],
52+
[0.23818197, 0.045490279, 0.051585594],
53+
[0.265205946, 0.0717474, 0.062501976]
54+
]
55+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"system": "DataFusion (Vortex, single)",
3+
"date": "2024-04-17",
4+
"machine": "c6a.4xlarge, 500gb gp2",
5+
"cluster_size": 1,
6+
"comment": "v46.0.0 (d5ca830) - Vortex 0.31 (b55e5e)",
7+
"tags": ["Rust", "column-oriented", "embedded", "stateless"],
8+
"load_time": 0,
9+
"data_size": 19232576496,
10+
"result": [
11+
[0.176994705, 0.011382751, 0.011270804],
12+
[0.221547472, 0.026744928, 0.025312513],
13+
[0.290957219, 0.077373655, 0.074357094],
14+
[0.680600995, 0.122673132, 0.120397535],
15+
[1.093692933, 0.838607568, 0.844200342],
16+
[1.267295418, 0.949021716, 1.04729551],
17+
[0.179333608, 0.011244602, 0.011351448],
18+
[0.235336665, 0.031524964, 0.030162963],
19+
[1.682356033, 1.015002579, 1.012261531],
20+
[2.417708893, 1.060927633, 1.034220256],
21+
[0.730126357, 0.153326026, 0.145909393],
22+
[0.929646725, 0.159971523, 0.168804681],
23+
[1.569882169, 0.843648034, 0.836573401],
24+
[2.694940613, 1.028694734, 1.046254204],
25+
[1.493414715, 0.690664637, 0.690134865],
26+
[1.215012872, 1.003494817, 0.988223164],
27+
[2.641574409, 1.9933659, 2.007560104],
28+
[2.53431833, 1.914622757, 1.969057032],
29+
[4.27071918, 3.458726513, 3.539167509],
30+
[0.548700299, 0.046473648, 0.045747114],
31+
[13.181304648, 0.507392675, 0.504357863],
32+
[14.432234763, 0.667277346, 0.665997159],
33+
[18.054398939, 1.202536218, 1.215226116],
34+
[53.243285046, 2.359238834, 2.402279267],
35+
[1.943101792, 0.232057945, 0.226861564],
36+
[1.026589282, 0.341059763, 0.3460303],
37+
[1.977405243, 0.322661299, 0.318256125],
38+
[13.909175175, 1.437504796, 1.417082247],
39+
[18.913907483, 9.532785946, 9.910900618],
40+
[0.720384936, 0.494056568, 0.521296886],
41+
[2.657040751, 0.560348171, 0.566754313],
42+
[5.773953823, 0.626700197, 0.634452829],
43+
[4.419303353, 3.573601142, 3.588632729],
44+
[13.498364976, 3.496021063, 3.465104325],
45+
[13.484060439, 3.53455701, 3.570352983],
46+
[1.531610346, 1.355472051, 1.391781439],
47+
[0.285861253, 0.090111849, 0.106896791],
48+
[0.219209445, 0.053735147, 0.048271311],
49+
[0.265905753, 0.045477324, 0.045286933],
50+
[0.411366345, 0.173163666, 0.208591591],
51+
[0.261094206, 0.034197751, 0.031218184],
52+
[0.256866943, 0.029741116, 0.029713634],
53+
[0.270036499, 0.046229829, 0.0459]
54+
]
55+
}

datafusion-vortex/run.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# Check if an argument is provided
4+
if [ "$#" -ne 1 ]; then
5+
echo "Usage: $0 [single|partitioned]"
6+
exit 1
7+
fi
8+
9+
# Set the SQL file based on the argument
10+
if [ "$1" == "single" ] || [ "$1" == "partitioned" ]; then
11+
FLAVOR=$1
12+
echo "Running benchmark for $FLAVOR"
13+
else
14+
echo "Invalid argument. Please use 'single' or 'partitioned'."
15+
exit 1
16+
fi
17+
18+
# clear results file
19+
touch results.csv
20+
> results.csv
21+
22+
TRIES=3
23+
OS=$(uname -s)
24+
25+
for query_num in $(seq 0 42); do
26+
sync
27+
28+
if [ "$OS" = "Linux" ]; then
29+
echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
30+
elif [ "$OS" = "Darwin" ]; then
31+
sudo purge
32+
fi
33+
34+
echo -n "["
35+
for i in $(seq 1 $TRIES); do
36+
# Parse query results out of the JSON output, which reports the time in ns
37+
RES=$(RUST_LOG=off clickbench -i 1 --flavor $FLAVOR --targets datafusion:vortex --display-format gh-json --queries-file ./queries.sql -q $query_num --hide-progress-bar | jq ".value / 1000000000")
38+
39+
[[ $RES != "" ]] && \
40+
echo -n "$RES" || \
41+
echo -n "null"
42+
[[ "$i" != $TRIES ]] && echo -n ", "
43+
echo "${query_num},${i},${RES}" >> results.csv
44+
done
45+
echo "],"
46+
done

0 commit comments

Comments
 (0)