Module: BigBench::Configuration

Defined in:
lib/bigbench/configuration.rb

Overview

The configuration is configured in the test reciepts and looks like this:

BigBench.configure do |config|
  config.duration    = 10.seconds,
  config.output      = "test.ljson",
  config.users       = 20,
  config.basic_auth  = ['username', 'secret']
end

Single values can be set and retrieved like this:

BigBench.config.duration = 20.minutes
BigBench.config.duration # => 1200 (seconds)

The following configuration values are possible - stared configurations need to be present:

duration*

How long will the benchmark take by default. This value can be overridden by every benchmark.

output*

The file where the results should be written to. Usually one takes the *.ljson format which is simply a file that contains a fully valid JSON object on every line. This makes it easy to process the results later on, because there’s no need to parse the whole results JSON, which can get huge, at once.

users

How many users execute the benchmarks concurrently. This can be overridden by every benchmark and defaults to 1.

basic_auth

A basic authentication that is used by ALL requests. This can be overridden per fragment in every benchmark.

BigBench.config.basic_auth = ['username', 'password']

Constant Summary collapse

DEFAULTS =
{
  :duration         => 1.second,
  :output           => "result.ljson",
  :users            => 1,
  :mode             => :local,
  :bot_checks_every => 1.minute
}

Class Method Summary collapse

Class Method Details

.configObject

Returns tor creates the config object



46
47
48
# File 'lib/bigbench/configuration.rb', line 46

def self.config
  @@config ||= OpenStruct.new(DEFAULTS)
end

.reset!Object

Resets the config object



39
40
41
# File 'lib/bigbench/configuration.rb', line 39

def self.reset!
  @@config = nil
end