ClickHouse/benchmark/clickhouse/benchmark-chyt.sh

23 lines
835 B
Bash
Raw Normal View History

#!/usr/bin/env bash
QUERIES_FILE="queries.sql"
TABLE=$1
TRIES=3
cat "$QUERIES_FILE" | sed "s|{table}|\"${TABLE}\"|g" | while read query; do
echo -n "["
for i in $(seq 1 $TRIES); do
while true; do
2020-01-28 19:17:30 +00:00
RES=$(command time -f %e -o /dev/stdout curl -sS -G --data-urlencode "query=$query" --data "default_format=Null&max_memory_usage=100000000000&max_memory_usage_for_all_queries=100000000000&max_concurrent_queries_for_user=100&database=*$YT_CLIQUE_ID" --location-trusted -H "Authorization: OAuth $YT_TOKEN" "$YT_PROXY.yt.yandex.net/query" 2>/dev/null);
2020-01-28 16:59:32 +00:00
if [[ $? == 0 ]]; then
2020-01-28 19:17:30 +00:00
[[ $RES =~ 'fail|Exception' ]] || break;
2020-01-28 16:59:32 +00:00
fi
done
[[ "$?" == "0" ]] && echo -n "${RES}" || echo -n "null"
[[ "$i" != $TRIES ]] && echo -n ", "
done
echo "],"
done