Loadex (Loadex v0.1.0) View Source

A simple distributed load test runner.

Loadex was created with two things in mind - genarating huge loads in a controlled manner, while being able to fully customize the test's flow. These goals are achieved by using plain Elixir to create scenarios and then laveraging Elixir's massive concurrency capabilities to run them on one or multiple machines.

Example:

defmodule ExampleScenario do
  use Loadex.Scenario

  setup do
    1..100
  end

  scenario index do
    loop_after 500, 10, iteration do
      IO.puts("My number is #{index}, iteration #{iteration}!")
    end
  end

  teardown index do
    IO.puts("Bye from #{index}!")
  end
end

For detailed instructions on how to create a scenario please refer to Loadex.Scenario.

Link to this section Summary

Functions

Adds nodes into the Loadex cluster.

Stops all scenarios.

Link to this section Functions

Specs

join_cluster(nodes :: [atom()]) :: [atom()]

Adds nodes into the Loadex cluster.

Link to this function

run(opts \\ [restart: false, scenario: nil, rate: 1000])

View Source

Specs

run(
  opts :: [
    restart: boolean(),
    scenario: nil | binary(),
    rate: non_neg_integer()
  ]
) :: {:ok, :scenarios_started}

Runs scenarios.

Running a scenario means executing its setup callback and passing its results to the scenario implementation. For more detailed information on how to create scenarios please refer to Loadex.Scenario.

When running in a distributed environment (see join_cluster/1), the setup callback will be executed on a node run/1 is called on and its results will be distributed along the cluster.

By default scenarios are loaded from ./scenarios directory and executed all at the same time. A single scenario can be specified by passing a scenario option.

Scenarios can be restarted after crashing or quitting by passing restart: true option.

Rate (per second), at which scenarios are started can be adjusted by passing a rate option. Note: this doesn't affect restart rate.

Example:

iex> Loadex.run(scenario: "./scenarios/example_scenario.exs", rate: 30, restart: true)

Specs

stop_all() :: :ok

Stops all scenarios.