Blitzy - A not so simple HTTP load tester in Elixir


Inspired by this [post]( by Victor Martinez of WatchSumo.

% ./blitzy -n 100 -r 2 -s get

## Distributed Blitzy

It is _way_ more fun to start distributed. Edit the provided `config/config.exs` with whatever node name suits your fancy. This is optional, and you can stick to the provided one.

config :blitz, master_node: :"a@"

config :blitz, slave_nodes: [:"b@", 

Here, the master node is `:a@`; the rest are slave nodes.

Start up a couple of nodes, and name them accordingly. For example, here's how to start one of them:

% iex --name b@ -S mix

Now, when you run the the command

% ./blitzy -n 2 -r 2 -s get

the requests will be split across the number of nodes you created, including the master node. Here's an example run:

11:36:10.961 [info]  Protocol 'inet_tcp': register/listen error: econnrefused

11:36:12.116 [info]  worker [nonode@nohost-#PID<0.102.0>] completed in 1092.0 msecs with code 200

11:36:12.116 [info]  worker [nonode@nohost-#PID<0.101.0>] completed in 1092.0 msecs with code 403

11:36:12.116 [info]  worker [nonode@nohost-#PID<0.110.0>] completed in 0.0 msecs with code 200

11:36:12.116 [info]  worker [nonode@nohost-#PID<0.111.0>] completed in 0.0 msecs with code 403

11:36:12.116 [info]  Finished pummelling with get scenario and with 2 workers for 1 times over 1 nodes.
Total requests    : 4
Total workers    : 2
Successful reqs  : 4
Failed reqs      : 0
Average (msecs)  : 546.0
Longest (msecs)  : 1092.0
Shortest (msecs) : 0.0
RPS (secs)       : 3.558718861209964

15:00:34.574 [info]  worker [b@<0.178.0>] completed in 517.94 msecs

15:00:35.105 [info]  worker [b@<0.185.0>] completed in 326.516 msecs

## Scenarios with several request

`lib\scenario.ex` contains examples how to write scenario with several steps.  
Every step (http request) should have unique name, otherwise it will not be possible to create html report for that particular request.  
Consult [httpoison]( documentation.  
When you are done with scenario, you need to build blitzy with `mix`

## Application secrets

Store you secrets in config/secrets.exs file.

## Results file

When blitzy is finished, it creates cummulative `results.txt` file in following format:


Field description: http request result :ok or :error, duration in milliseconds, http status code, request start timestamp as epoch, scenario method name

Generate report

When run is done:  

`./blitzy -o report_name.html -s scenario_name`  

Here is one report ![](graph_example.png)

## Contribute

install latest elixir for you os
mix local.hex
mix deps.get
### Run tests

MIX_ENV=test mix coveralls.html`
`open cover/excoveralls.html`

### Git

create branch in github
git fetch
git checkout branch_name
git push
create pull request using github

### Notes

create tests for your contribution
run tests