Skip to content

Commit 3b09ce4

Browse files
authored
Merge pull request ClickHouse#363 from GlareDB/sean/update-glaredb
2 parents 84c53a7 + 346c84a commit 3b09ce4

File tree

7 files changed

+194
-158
lines changed

7 files changed

+194
-158
lines changed

glaredb/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# The binary
2+
/glaredb
3+
4+
# Any of the hits files
5+
/data
6+
7+
# Result data, should be manually copied to the right spot if being kept.
8+
results.csv
9+
results.json

glaredb/benchmark.sh

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,42 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
# Install
3+
set -e
44

5-
sudo apt-get install -y unzip
6-
curl https://glaredb.com/install.sh | sh
5+
repo_root=$(git rev-parse --show-toplevel)
6+
script_dir=$(dirname "$0")
77

8-
wget https://clickhouse-public-datasets.s3.eu-central-1.amazonaws.com/hits_compatible/athena/hits.parquet
8+
if [[ "$(basename "$repo_root")" == "glaredb" ]]; then
9+
# Inside glaredb repo, build from source.
10+
cargo build --release --bin glaredb
11+
cp "${repo_root}/target/release/glaredb" "${script_dir}/glaredb"
12+
else
13+
# Not in glaredb repo, use prebuilt binary.
14+
export GLAREDB_INSTALL_DIR="${script_dir}"
15+
export GLAREDB_VERSION="v25.5.2"
16+
curl -fsSL https://glaredb.com/install.sh | sh
17+
fi
918

10-
cat queries.sql | while read -r query
11-
do
12-
sync
13-
echo 3 | sudo tee /proc/sys/vm/drop_caches
19+
# Get the data.
20+
mkdir -p "${script_dir}/data"
21+
pushd "${script_dir}/data"
1422

15-
for i in $(seq 1 3); do
16-
./glaredb --timing --query "${query}"
17-
done;
18-
done 2>&1 | tee log.txt
23+
mode="${1:-single}" # Default to 'single' if no arg given.
24+
case "${mode}" in
25+
single)
26+
wget --continue https://clickhouse-public-datasets.s3.eu-central-1.amazonaws.com/hits_compatible/athena/hits.parquet
27+
;;
28+
partitioned)
29+
seq 0 99 | xargs -P100 -I{} bash -c 'wget --continue https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_{}.parquet'
30+
;;
31+
*)
32+
echo "Invalid argument to 'benchmark.sh', expected 'single' or 'partitioned'"
33+
exit 1
34+
;;
35+
esac
36+
popd
1937

20-
cat log.txt | grep -oP 'Time: \d+\.\d+s|Error' | sed -r -e 's/Time: ([0-9]+\.[0-9]+)s/\1/; s/Error/null/' | awk '{ if (i % 3 == 0) { printf "[" }; printf $1; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'
38+
# Ensure working directory is the script dir. The view that gets created uses a
39+
# relative path.
40+
pushd "${script_dir}"
41+
42+
./run.sh "${mode}"

glaredb/create_single.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE TEMP VIEW hits AS
2+
SELECT * REPLACE (EventDate::DATE AS EventDate)
3+
FROM read_parquet('./data/hits.parquet');

glaredb/queries.sql

Lines changed: 43 additions & 43 deletions
Large diffs are not rendered by default.

glaredb/results/c6a.4xlarge.json

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
{
2-
"system": "GlareDB",
3-
"date": "2024-02-02",
2+
"system": "GlareDB (Parquet, single)",
3+
"date": "2025-05-06",
44
"machine": "c6a.4xlarge, 500gb gp2",
55
"cluster_size": 1,
66
"comment": "",
77
"tags": ["Rust", "serverless"],
88
"load_time": 0,
99
"data_size": 14779976446,
1010
"result": [
11-
[0.221,0.070,0.069],
12-
[0.509,0.425,0.424],
13-
[0.569,0.462,0.466],
14-
[0.787,0.483,0.470],
15-
[1.339,1.220,1.200],
16-
[1.800,1.644,1.649],
17-
[0.490,0.418,0.410],
18-
[0.509,0.423,0.423],
19-
[2.009,1.880,1.920],
20-
[3.383,3.134,3.147],
21-
[0.950,0.695,0.702],
22-
[0.891,0.743,0.721],
23-
[1.787,1.646,1.654],
24-
[4.032,3.007,2.974],
25-
[1.911,1.746,1.762],
26-
[1.538,1.321,1.360],
27-
[3.746,3.335,3.327],
28-
[3.611,3.064,2.993],
29-
[7.835,6.293,6.414],
30-
[0.882,0.469,0.470],
31-
[9.903,1.943,1.947],
32-
[11.653,2.182,2.172],
33-
[22.503,4.410,4.416],
34-
[56.481,11.754,11.769],
35-
[3.039,0.925,0.917],
36-
[1.132,0.854,0.855],
37-
[2.939,0.991,0.973],
38-
[9.958,2.688,2.695],
39-
[9.431,5.639,5.614],
40-
[1.027,0.872,0.814],
41-
[2.611,1.508,1.497],
42-
[6.177,1.887,1.960],
43-
[9.675,9.095,8.891],
44-
[12.268,7.139,7.063],
45-
[12.675,7.661,7.671],
46-
[2.418,2.250,2.210],
47-
[9.998,2.095,2.066],
48-
[9.273,2.782,2.722],
49-
[10.015,2.085,2.079],
50-
[18.876,3.284,3.317],
51-
[2.963,0.939,0.917],
52-
[2.165,0.973,0.936],
53-
[1.380,0.901,0.864]
54-
]
11+
[0.044,0.038,0.037],
12+
[0.147,0.131,0.134],
13+
[0.231,0.207,0.204],
14+
[0.311,0.160,0.152],
15+
[1.064,1.010,1.005],
16+
[1.072,1.008,1.038],
17+
[0.127,0.111,0.111],
18+
[0.159,0.139,0.146],
19+
[1.583,1.512,1.480],
20+
[1.919,1.839,1.827],
21+
[0.598,0.535,0.528],
22+
[0.680,0.614,0.616],
23+
[1.105,1.013,0.995],
24+
[2.921,2.089,2.053],
25+
[1.228,1.109,1.106],
26+
[1.382,1.349,1.330],
27+
[2.997,2.447,2.431],
28+
[2.707,2.086,2.092],
29+
[5.820,4.520,4.625],
30+
[0.246,0.193,0.193],
31+
[9.619,1.751,1.761],
32+
[11.123,1.493,1.476],
33+
[21.896,3.584,3.538],
34+
[55.927,14.498,14.510],
35+
[2.526,0.884,0.873],
36+
[1.022,0.974,0.964],
37+
[2.544,1.081,1.077],
38+
[9.457,1.559,1.503],
39+
[11.226,12.444,12.082],
40+
[4.675,4.722,4.769],
41+
[2.161,1.257,1.251],
42+
[5.866,1.583,1.582],
43+
[7.481,6.244,6.247],
44+
[10.969,3.891,3.921],
45+
[11.092,4.200,4.157],
46+
[1.472,1.433,1.446],
47+
[0.243,0.191,0.191],
48+
[0.180,0.154,0.153],
49+
[0.180,0.127,0.124],
50+
[0.444,0.348,0.343],
51+
[0.102,0.075,0.075],
52+
[0.089,0.069,0.074],
53+
[0.094,0.079,0.079]
54+
]
5555
}

glaredb/results/c6a.metal.json

Lines changed: 0 additions & 55 deletions
This file was deleted.

glaredb/run.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
set -o pipefail
5+
6+
case "$1" in
7+
single)
8+
create_sql_file="create_single.sql"
9+
;;
10+
*)
11+
echo "Invalid argument to 'run.sh', expected 'single'"
12+
exit 1
13+
;;
14+
esac
15+
16+
TRIES=3
17+
QUERY_NUM=0
18+
19+
echo "[" > results.json
20+
echo "query_num,iteration,duration" > results.csv
21+
22+
cat queries.sql | while read -r query; do
23+
sync
24+
echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null
25+
26+
echo "${QUERY_NUM}: ${query}"
27+
28+
[ "${QUERY_NUM}" != 0 ] && echo "," >> results.json
29+
echo -n " [" >> results.json
30+
31+
for i in $(seq 1 $TRIES); do
32+
output=$(./glaredb --init "${create_sql_file}" -c ".timer on" -c "${query}")
33+
duration=$(awk -F': ' '/^Execution duration/ { printf "%.3f\n", $2 }' <<< "$output")
34+
35+
echo "$output"
36+
37+
if [ -z "${duration}" ]; then
38+
echo "Query failed"
39+
exit 1
40+
fi
41+
42+
# JSON results
43+
echo -n "${duration}" >> results.json
44+
[ "${i}" != "${TRIES}" ] && echo -n "," >> results.json
45+
46+
# CSV results
47+
echo "${QUERY_NUM},${i},${duration}" >> results.csv
48+
done
49+
50+
echo -n "]" >> results.json
51+
52+
QUERY_NUM=$((QUERY_NUM + 1))
53+
done
54+
55+
echo "" >> results.csv
56+
echo "" >> results.json
57+
echo "]" >> results.json

0 commit comments

Comments
 (0)