Sha256: ba51eaedd9a417114209c6560e9772dab9d279fbefda220965d881ecf00e8ff5

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env bash

set -u

uuid=$(echo $(uuidgen) | tr '[:upper:]' '[:lower:]')

stream_name="testStream-$uuid"
if [ ! -z ${STREAM_NAME+x} ]; then
  stream_name=$STREAM_NAME
fi

cycles=1000
if [ ! -z ${CYCLES+x} ]; then
  cycles=$CYCLES
fi

function script_dir {
  val="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  echo "$val"
}

base=$(script_dir)

echo
echo "Benchmark $cycles cycles (Stream Name: $stream_name)"
echo "= = ="
echo

if [ -z ${DATABASE_NAME+x} ]; then
  echo "(DATABASE_NAME is not set)"
  database=message_store
else
  database=$DATABASE_NAME
fi
echo "Database name is: $database"
echo

echo "Installing benchmark scripts"
echo

psql $database -q -f $base/benchmark_write.sql
psql $database -q -f $base/benchmark_get.sql

echo
echo "Benchmarking write"
echo "- - -"
echo

psql $database -U message_store -c "EXPLAIN ANALYZE SELECT benchmark_write('$stream_name'::varchar, $cycles::int);"

echo

echo
echo "Benchmarking get"
echo "- - -"
echo

psql $database -U message_store -c "EXPLAIN ANALYZE SELECT benchmark_get('$stream_name'::varchar, $cycles::int);"

echo "= = ="
echo "Done"
echo

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
message-db-2.1.6 database/benchmark.sh
message-db-2.1.5 database/benchmark.sh
message-db-2.1.4 database/benchmark.sh
message-db-2.1.3 database/benchmark.sh
message-db-2.1.2 database/benchmark.sh
message-db-2.1.1 database/benchmark.sh
message-db-2.1.0 database/benchmark.sh
message-db-2.0.2 database/benchmark.sh
message-db-2.0.1 database/benchmark.sh
message-db-2.0.0 database/benchmark.sh
message-db-1.1.3 database/benchmark.sh
message-db-1.1.2 database/benchmark.sh
message-db-1.1.1 database/benchmark.sh
message-db-1.1.0 database/benchmark.sh
message-db-1.0.0 database/benchmark.sh