package
0.0.2
Repository: https://github.com/dinal/v3io-tsdb.git
Documentation: pkg.go.dev

# README

Running the benchmark test

Prerequisites

  • A fully operational V3IO Setup (Data and Application nodes)

Configuration

Create custom v3io.yaml configuration.

Use the following example for reference:

    # File: v3io-custom.yaml
    
    # NGINX server address:PORT
    v3ioUrl: "localhost:8081"
    
    # V3IO container ID or Name
    container: "bigdata"
    
    # Path in the container
    path: "tsdb-1"
    
    # Logging level. Valid values: debug,info,warn,error (Default: info)
    verbose: "warn"

    # V3IO Credentials
    username: "<user>@<tenant>"
    password: "<password>"

Create TSDB instance using tsdbctl.

Use the following shell script for 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 TSDB instance at $TSDB_PATH"
    
    # Create TSDB instance "tsdb" with some pre-aggregations and interval of 5 seconds (-v for verbose mode)
    SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
    $SCRIPTPATH/tsdbctl create -p $TSDB_PATH -r count,sum,min,max -i 5 -v -c $SCRIPTPATH/v3io-custom.yaml
    
    echo Done.

Create test configuration file tsdb-bench-test-config.yaml

Use the following example for reference:

# File: tsdb-bench-test-config.yaml

# Control Nuclio test verbosity
Verbose: true

# Relative time, i.e. now() - startTimeOffset
StartTimeOffset: "48h"

# Interval in milliseconds between samples
SampleStepSize: 5000

# should be in range [1..26], i.e [A..Z]
NamesCount: 2

# Pattern: Name_[A..Z][_[1..200]]
NamesDiversity: 1

# should be in range [1..26]
LabelsCount: 1

# Pattern: Label_[A..Z][_[1..10]]
LabelsDiversity: 3

# should be in range [1..26], i.e [A..Z]
LabelValuesCount: 1

# Pattern: [A..Z][_[1..10]]
LabelsValueDiversity: 10

# Flush frequency - flush metrics after every N steps
FlushFrequency: 10

# Select how benchmark test will produce the data. If "AppendOneByOne=true" test will produce one sample per test cycle
AppendOneByOne: true

Define following environment variables.

Note: you can also define variables locally in a script

    V3IO_TSDBCFG_PATH="$HOME/go/bin/v3io-custom.yaml"
    TSDB_BENCH_INGEST_CONFIG="$HOME/go/bin/tsdb-bench-test-config.yaml"

Run ingestion benchmark test for desired time interval to populate the TSDB.

Use the following script as a reference:

Note: you can pass test duration to the script.
For example: ./ingest.sh 5m will run 5 minutes.
By default it will run 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 "-bench=^BenchmarkIngest$" or "-bench=^BenchmarkIngestWithNuclio$" test
    time V3IO_TSDBCFG_PATH="$HOME/go/bin/v3io-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 Query using tsdbctl

Or use the following shell script example to query counts for all types of metrics generated by the test. Test produces Name_(A..Z)_(0..20) metrics.

Note: The script below is fetching count for last 72 hours with intervals of 5 min (which is similar to the TSDB rollip interval)

    #!/bin/bash
    
    #File: query.sh
    
    GOBIN=$HOME/go/bin
    LOOK_BACK_INTERVAL=72h
    TSDB_ROLLUP_INTERVAL=5m
    V3IO_CONFIG_PATH=$GOBIN/v3io-custom.yaml
    
    for x in {A..Z}
    do
      for ((i = 0; i < 10; i++))
      do
        echo Querying Name_${x}_${i} ...
        $GOBIN/tsdbctl query Name_${x}_${i} -a count -l $LOOK_BACK_INTERVAL -i $TSDB_ROLLUP_INTERVAL  -c $V3IO_CONFIG_PATH
      done
    done
    
    echo Done

Example: Calculate total count

    #!/bin/bash
   
    # Flile: count-all.sh
     
    echo Fetching...
    
    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 samples count is: $COUNT

# Packages

No description provided by the author