# Packages
# README
Running the Benchmark Test
Prerequisites
- A fully operational Iguazio Data Science Platform setup (with data and application nodes)
Configuration
Create a Custom TSDB Configuration File
You can optionally create a TSDB configuration file instead of setting the relevant configuration using TSDB CLI configuration flags. Use the example configuration-file template at examples/ as a reference. By default, the TSDB CLI (tsbbctl) looks for a v3io-tsdb-config.yaml file in the current directory.
Create a TSDB Instance Using the TSDB CLI
Use the create
command of the TSDB CLI to create a new TSDB instance (table).
Run tsdbctl create -h
for detailed information.
You can use the following shell script as a reference:
Note: The script assumes that all configuration and executable files reside at the
${HOME}/go/bin
directory.
#!/bin/bash
if [ "$1" == "" ]; then
TSDB_PATH="pmetric"
else
TSDB_PATH=$1
fi
echo "Creating a TSDB instance at '$TSDB_PATH' ..."
# Create a TSDB instance "tsdb" with a sampling rate of of one sample per
# second, some aggregates, and an aggregation interval of 5 seconds.
# Use -v to run in verbose mode. Use the -g flag to point to the
# configuration file that you created in the previous step, or set the
# web-gateway service endpoint and authentication credentials and the
# parent data container using the CLI -s, -u, -p, and -c flags.
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
$SCRIPTPATH/tsdbctl create -t $TSDB_PATH -r 1/s -a count,sum,min,max -i 5 -v -g $SCRIPTPATH/v3io-tsdb-custom.yaml
echo Done.
Create a Benchmark-Test Ingestion Configuration File
Create a tsdb-bench-test-config.yaml configuration file for the TSDB ingestion benchmark test. Use test/benchmark/testdata/tsdb-bench-test-config.yaml as a reference.
Define Required Environment Variables
Define the following environment variables.
Note: You can also define variables locally in a script or in the command line from which the relevant command is executed.
V3IO_TSDB_CONFIG="$HOME/go/bin/v3io-tsdb-custom.yaml"
TSDB_BENCH_INGEST_CONFIG="$HOME/go/bin/tsdb-bench-test-config.yaml"
Run the Ingestion Benchmark Test
Run the ingestion benchmark test to populate the TSDB, using the desired time interval.
Use the following script as a reference:
Note: You can pass a "[0-9]+[mhd]" test-duration parameter to the script.
For example: `./ingest.sh 5m` will run 5 minutes.
> By default, the test will run for one minute.
#!/bin/bash
#File: ingest.sh
if [ "$1" == "" ]; then
BENCH_TIME="1m"
else
BENCH_TIME="$1"
fi
echo "Ingesting samples (bench time = $BENCH_TIME) ..."
cd $HOME/go/src/github.com/v3io/v3io-tsdb/cmd/tsdbctl
# Note: You can select either the "-bench=^BenchmarkIngest$" or
# "-bench=^BenchmarkIngestWithNuclio$" test.
time V3IO_TSDB_CONFIG="$HOME/go/bin/v3io-tsdb-custom.yaml" TSDB_BENCH_INGEST_CONFIG="$HOME/go/bin/tsdb-bench-test-config.yaml" go test -benchtime $BENCH_TIME -run=DO_NOT_RUN_TESTS -bench=^BenchmarkIngest$ ../../test/benchmark
echo Done
Run a TSDB Query
Use the querey
command of the TSDB CLI (tsdbctl) to query the test TSDB instance.
Run tsdbctl query -h
for detailed information.
The test produces Name_(A..Z)_(0..20)
metrics.
You can use the following shell script example to query counts for all types of metrics generated by the test.
Note: The following script fetches a
count
aggregate calculation for the last 72 hours with an aggregation interval of 5 minutes (which is similar to the TSDB aggregation granularity).
#!/bin/bash
#File: query.sh
GOBIN=$HOME/go/bin
LOOK_BACK_DURATION=72h
TSDB_AGGREGATION_INTERVAL=5m
V3IO_TSDB_CONFIG=$GOBIN/v3io-tsdb-custom.yaml
for x in {A..Z}
do
for ((i = 0; i < 10; i++))
do
echo Querying metric Name_${x}_${i} ...
$GOBIN/tsdbctl query Name_${x}_${i} -a count -l $LOOK_BACK_DURATION -i $TSDB_AGGREGATION_INTERVAL -g $V3IO_CONF
done
done
echo Done
Example: Calculate a Total Samples Count
#!/bin/bash
# File: count-all.sh
echo Querying the TSDB ...
GOBIN=$HOME/go/bin
COUNT="$($GOBIN/query.sh | grep -v "v=0" | grep 2018 | cut -d'=' -f 2 | awk '{s+=$1} END {print s}')"
echo Total count of 2018 metric samples with value 0: $COUNT