Adjustments

This commit is contained in:
Alexey Milovidov 2022-07-01 00:15:17 +02:00
parent 8ba93a8170
commit 69b0508d47
2 changed files with 11 additions and 12 deletions

View File

@ -1,17 +1,20 @@
#!/bin/bash #!/bin/bash
# If you have no java installed:
# sudo apt-get update sudo apt-get update
# sudo apt install openjdk-8-jdk -y sudo apt install openjdk-8-jdk -y
# sudo update-alternatives --config java sudo update-alternatives --config java
# Install
VERSION=0.23.0 VERSION=0.23.0
# Install
wget -O"apache-druid-${VERSION}-bin.tar.gz" "https://dlcdn.apache.org/druid/${VERSION}/apache-druid-${VERSION}-bin.tar.gz" wget -O"apache-druid-${VERSION}-bin.tar.gz" "https://dlcdn.apache.org/druid/${VERSION}/apache-druid-${VERSION}-bin.tar.gz"
tar xf apache-druid-${VERSION}-bin.tar.gz tar xf apache-druid-${VERSION}-bin.tar.gz
./apache-druid-${VERSION}/bin/verify-java ./apache-druid-${VERSION}/bin/verify-java
# Have to increase indexer memory limit # Have to increase indexer memory limit
sed -i 's MaxDirectMemorySize=1g MaxDirectMemorySize=5g g' apache-druid-$VERSION/conf/druid/single-server/medium/middleManager/runtime.properties sed -i 's MaxDirectMemorySize=1g MaxDirectMemorySize=5g g' apache-druid-$VERSION/conf/druid/single-server/medium/middleManager/runtime.properties
# Druid launcher does not start Druid as a daemon. Run it in background # Druid launcher does not start Druid as a daemon. Run it in background
./apache-druid-${VERSION}/bin/start-single-server-medium & ./apache-druid-${VERSION}/bin/start-single-server-medium &
@ -20,10 +23,11 @@ sed -i 's MaxDirectMemorySize=1g MaxDirectMemorySize=5g g' apache-druid-$VERSION
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz' wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
gzip -d hits.tsv.gz gzip -d hits.tsv.gz
split --additional-suffix .tsv --verbose -n l/10 hits.tsv input split --additional-suffix .tsv --verbose -n l/10 hits.tsv input
# Running 10 tasks one by one to make it work in parallel # Running 10 tasks one by one to make it work in parallel
./apache-druid-${VERSION}/bin/post-index-task --file ingest.json --url http://localhost:8081 ./apache-druid-${VERSION}/bin/post-index-task --file ingest.json --url http://localhost:8081
# Run the queries
# Run the queries
./run.sh ./run.sh
# stop Druid services # stop Druid services

View File

@ -1,21 +1,16 @@
#!/bin/bash #!/bin/bash
TRIES=3 TRIES=3
QUERY_NUM=1
cat queries.sql | while read query; do cat queries.sql | while read query; do
sync sync
echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
echo -n "[" echo -n "["
for i in $(seq 1 $TRIES); do for i in $(seq 1 $TRIES); do
echo "{\"query\":\"$query\"}"| sed -e 's EventTime __time g' | tr -d ';' > query.json echo "{\"query\":\"$query\"}"| sed -e 's EventTime __time g' | tr -d ';' > query.json
RES=$(curl -o /dev/null -s -w '%{time_total}\n' -XPOST -H'Content-Type: application/json' http://localhost:8888/druid/v2/sql/ -d @query.json) RES=$(curl -o /dev/null -s -w '%{time_total}\n' -XPOST -H'Content-Type: application/json' http://localhost:8888/druid/v2/sql/ -d @query.json)
[[ "$?" == "0" ]] && echo -n "${RES}" || echo -n "null" [[ "$?" == "0" ]] && echo -n "${RES}" || echo -n "null"
[[ "$i" != $TRIES ]] && echo -n ", " [[ "$i" != $TRIES ]] && echo -n ", "
echo "${QUERY_NUM},${i},${RES}" >> result.csv
done done
echo "]," echo "],"
QUERY_NUM=$((QUERY_NUM + 1))
done done