Skip to content

Commit c2a8d50

Browse files
committed
Validated test results and cleaned-up bench code.
1 parent a065bef commit c2a8d50

File tree

8 files changed

+97
-104
lines changed

8 files changed

+97
-104
lines changed

tembo-olap/README.md

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
# Instantiation
22

3-
1- Create Account and Login to https://cloud.tembo.io
4-
5-
2- Select OLAP Stack after clicking Create Instance button.
6-
7-
![Instance for benchmark](olap-stack.png "OLAP Stack")
8-
3+
1) Create Account and Login to https://cloud.tembo.io
4+
2) Select OLAP Stack after clicking Create Instance button
95

106
## Choose System Configuration:
117

@@ -15,62 +11,21 @@
1511

1612
**RAM** : 32GB
1713

18-
**Storage**: 300GB
19-
14+
**Storage**: 500GB
2015

21-
![Instance Type](olap-instance-type.png "OLAP Stack")
16+
Note: instance creation takes *20-25* seconds.
2217

23-
Instance creation takes *20-25* seconds.
24-
25-
## Connection String
18+
## Specify Connection params
2619
Tembo provides connection-string through instance **Home** tab.
2720

21+
Use hostname and password taken from Tembo console and specify them in benchmark.sh
2822
```
29-
export PGPASSWORD=TEMBO_GENERATED_PGPASSWORD
30-
export PGHOST=TEMBO_GENERATED_PGHOST
31-
```
32-
33-
## Data loading
34-
Data loaded remotely using psql client.
35-
36-
**psql** installation
37-
38-
```
39-
sudo apt-get update
40-
sudo apt-get install -y postgresql-client
41-
23+
HOSTNAME="<hostname>"
24+
PASSWORD="<password>"
4225
```
43-
**Data** download
4426

45-
```
46-
wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
27+
## Start Benchmark
4728

48-
gzip -d hits.tsv.gz
4929
```
50-
51-
**Data** loading
52-
53-
```
54-
psql postgresql://postgres:$PGPASSWORD@$PGHOST:5432 -t -c 'CREATE DATABASE test'
55-
56-
psql postgresql://postgres:$PGPASSWORD@$PGHOST:5432/test -t < create.sql
57-
58-
psql postgres://postgres:$PGPASSWORD@$PGHOST:5432/test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
59-
60-
psql postgresql://postgres:$PGPASSWORD@$PGHOST:5432/test -t < index.sql
61-
62-
psql postgres://postgres:$PGPASSWORD@$PGHOST:5432/test -t -c "select pg_total_relation_size('hits');"
63-
33864704000
64-
65-
66-
```
67-
68-
## Benchmark Start
69-
70-
```
71-
./run.sh 2>&1 | tee log.txt
72-
73-
cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' |
74-
awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'
75-
30+
./benchmark.sh
7631
```

tembo-olap/benchmark.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
HOSTNAME="<hostname>"
4+
PASSWORD="<password>"
5+
6+
sudo apt-get update
7+
sudo apt-get install -y postgresql-client
8+
9+
wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
10+
gzip -d hits.tsv.gz
11+
chmod 777 ~ hits.tsv
12+
13+
psql postgresql://postgres:$PASSWORD@$HOSTNAME:5432 -t -c 'CREATE DATABASE test'
14+
psql "host=$HOSTNAME port=5432 dbname=test user=postgres password=$PASSWORD sslmode=require" < create.sql
15+
psql "host=$HOSTNAME port=5432 dbname=test user=postgres password=$PASSWORD sslmode=require" -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
16+
psql "host=$HOSTNAME port=5432 dbname=test user=postgres password=$PASSWORD sslmode=require" < index.sql
17+
psql "host=$HOSTNAME port=5432 dbname=test user=postgres password=$PASSWORD sslmode=require" -t -c '\timing' -c "select pg_total_relation_size('hits');"
18+
19+
./run.sh "${HOSTNAME}" "${PASSWORD}" 2>&1 | tee log.txt
20+
21+
cat log.txt |
22+
grep -oP 'Time: \d+\.\d+ ms' |
23+
sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' |
24+
awk '{
25+
if (i % 3 == 0) {
26+
printf "[";
27+
}
28+
printf $1 / 1000;
29+
if (i % 3 != 2) {
30+
printf ",";
31+
} else {
32+
print "],";
33+
}
34+
++i;
35+
}'

tembo-olap/create.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CREATE EXTENSION IF NOT EXISTS COLUMNAR;
2-
DROP TABLE hits CASCADE;
2+
DROP TABLE IF EXISTS hits CASCADE;
33
CREATE TABLE hits
44
(
55
WatchID BIGINT NOT NULL,

tembo-olap/olap-instance-type.png

-66.6 KB
Binary file not shown.

tembo-olap/olap-stack.png

-36.3 KB
Binary file not shown.

tembo-olap/queries.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ SELECT URL, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >
4040
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;
4141
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;
4242
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', EventTime) LIMIT 10 OFFSET 1000;
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', EventTime) LIMIT 10 OFFSET 1000;
Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
{
2-
"system": "Tembo OLAP(Columnar)",
2+
"system": "Tembo OLAP (columnar)",
33
"date": "2024-02-09",
4-
"machine": "c6a.4xlarge, 300gb gp3",
4+
"machine": "c6a.4xlarge, 500gb gp3",
55
"cluster_size": 1,
66
"comment": "",
77

88
"tags": ["C", "PostgreSQL compatible", "column-oriented"],
99

10-
"load_time": 14998.247,
10+
"load_time": 4903,
1111
"data_size": 33864704000,
1212

1313
"result": [
14-
[0.322266,0.279012,0.278818],
15-
[0.262802,0.263067,0.263524],
16-
[1.03503,1.02851,1.01109],
17-
[0.694882,0.69194,0.684567],
18-
[24.1366,23.8622,24.2121],
19-
[37.8125,37.3546,37.4614],
20-
[0.088267,0.071204,0.072592],
21-
[0.27134,0.272216,0.270787],
22-
[25.1755,24.8466,24.944],
23-
[28.1199,28.1654,28.4494],
24-
[2.20623,2.17468,2.14656],
25-
[2.4656,2.4581,2.45926],
26-
[7.42677,7.57167,7.69995],
27-
[10.5288,10.3381,10.4471],
28-
[8.29726,8.19628,8.19725],
29-
[16.6094,16.9222,16.7514],
30-
[38.8504,38.4172,38.3965],
31-
[0.388963,0.358219,0.36013],
32-
[75.809,75.2281,76.712],
33-
[0.302681,0.303397,0.302277],
34-
[2.62566,2.61241,2.61167],
35-
[2.8029,2.81523,2.84338],
36-
[3.70515,3.68054,3.66689],
37-
[21.0447,20.8168,21.0621],
38-
[1.44812,1.34319,1.33672],
39-
[0.34479,0.318921,0.317873],
40-
[1.21699,1.20804,1.20271],
41-
[4.83795,4.79006,4.79372],
42-
[41.5645,41.008,40.9968],
43-
[7.96046,8.03584,7.98607],
44-
[8.77845,9.01301,8.9083],
45-
[14.8007,14.662,14.7183],
46-
[69.205,69.6116,70.0597],
47-
[32.5098,31.3654,32.3301],
48-
[33.5434,33.3958,33.0693],
49-
[14.3637,14.5175,14.395],
50-
[0.373303,0.373503,0.376101],
51-
[0.193498,0.190686,0.194189],
52-
[0.103831,0.111741,0.119202],
53-
[0.754824,0.760665,0.798245],
54-
[0.110722,0.110677,0.114796],
55-
[0.101987,0.10852,0.101449],
56-
[0.148887,0.12897,0.146846]
14+
[0.335424,0.288406,0.291833],
15+
[0.273387,0.276144,0.280566],
16+
[1.04303,1.03311,1.02745],
17+
[0.699428,0.698998,0.701829],
18+
[23.4004,23.0228,23.3303],
19+
[35.6514,35.9655,36.1087],
20+
[0.091153,0.074667,0.076713],
21+
[0.27855,0.276916,0.278651],
22+
[27.9524,27.7416,27.1891],
23+
[30.495,31.5809,30.8035],
24+
[2.98169,3.01209,2.96031],
25+
[3.36352,3.38749,3.32161],
26+
[9.25541,9.33663,9.30109],
27+
[10.6757,10.6452,10.352],
28+
[10.0414,9.99654,9.95628],
29+
[23.6013,23.7551,24.0158],
30+
[27.5649,26.7495,27.0685],
31+
[0.422969,0.37809,0.382737],
32+
[46.2609,46.2509,46.5879],
33+
[0.312248,0.312461,0.319174],
34+
[2.71278,2.74919,2.66242],
35+
[2.85679,2.8941,2.91063],
36+
[3.79428,3.82795,3.76534],
37+
[21.6777,21.8457,22.4842],
38+
[1.55266,1.4268,1.42082],
39+
[0.3739,0.336904,0.343475],
40+
[1.23959,1.22557,1.23188],
41+
[4.89249,4.94013,4.92233],
42+
[42.7291,42.4905,42.5116],
43+
[8.16955,8.15319,8.1022],
44+
[11.0438,10.8213,10.9278],
45+
[18.9006,18.1182,17.7459],
46+
[72.6787,71.4905,72.13],
47+
[44.2683,42.1593,42.9159],
48+
[44.1782,44.6741,44.1548],
49+
[17.2926,18.1069,17.8896],
50+
[0.393598,0.395635,0.394274],
51+
[0.234447,0.237086,0.196967],
52+
[0.108035,0.125385,0.117379],
53+
[0.78023,0.826582,0.806038],
54+
[0.106995,0.113052,0.118778],
55+
[0.120202,0.11803,0.119093],
56+
[0.153295,0.150266,0.151742]
5757
]
5858
}

tembo-olap/run.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#!/bin/bash
22

3+
HOSTNAME=$1
4+
PASSWORD=$2
5+
36
TRIES=3
47

58
cat queries.sql | while read query; do
69
echo "$query";
710
for i in $(seq 1 $TRIES); do
8-
psql postgres://postgres:$PGPASSWORD@$PGHOST:5432/test -t -c '\timing' -c "$query" | grep 'Time'
11+
psql "host=$HOSTNAME port=5432 dbname=test user=postgres password=$PASSWORD sslmode=require" -t -c '\timing' -c "$query" | grep 'Time'
912
done;
1013
done;

0 commit comments

Comments
 (0)