WRK_THREADS=8
TEST_CONCURRENCY=100
TEST_DURATION=10
HTTP_BASE=${HTTP_BASE:-http://127.0.0.1:8123/}

TEST_QUERY="SELECT distance('topK = 10')(vector, [10.0, 14.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 138.0, 51.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 153.0, 58.0, 0.0, 3.0, 16.0, 3.0, 0.0, 0.0, 7.0, 3.0, 0.0, 5.0, 153.0, 41.0, 0.0, 0.0, 2.0, 5.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 147.0, 50.0, 1.0, 0.0, 0.0, 0.0, 0.0, 3.0, 153.0, 45.0, 0.0, 1.0, 16.0, 1.0, 0.0, 12.0, 15.0, 2.0, 0.0, 2.0, 144.0, 29.0, 0.0, 1.0, 1.0, 1.0, 4.0, 1.0, 0.0, 0.0, 0.0, 0.0, 153.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 18.0, 153.0, 8.0, 0.0, 0.0, 9.0, 8.0, 1.0, 48.0, 14.0, 0.0, 0.0, 0.0, 87.0, 60.0, 1.0, 4.0, 2.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 127.0, 22.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 153.0, 90.0, 0.0, 0.0, 2.0, 3.0, 0.0, 2.0, 20.0, 13.0, 0.0, 0.0, 44.0, 42.0, 0.0, 0.0]) from test_sift10M"

CLICKHOUSE_URL=$(printf "%s?query=%s" "$HTTP_BASE" "$TEST_QUERY")
echo $CLICKHOUSE_URL

wrk -t $WRK_THREADS \
-c $TEST_CONCURRENCY \
-d $TEST_DURATION \
--timeout 30 \
--latency \
"'$CLICKHOUSE_URL'"