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 http://www.bieberfever.com
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: :"email@example.com" config :blitz, slave_nodes: [:"firstname.lastname@example.org", :"email@example.com", :"firstname.lastname@example.org"]
Here, the master node is
:email@example.com; 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 firstname.lastname@example.org -S mix
Now, when you run the the command
% ./blitzy -n 2 -r 2 -s get http://www.bieberfever.com
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 http://www.bieberfever.com 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 [email@example.com-#PID<0.178.0>] completed in 517.94 msecs 15:00:35.105 [info] worker [firstname.lastname@example.org-#PID<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
Store you secrets in config/secrets.exs 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
When run is done:
./blitzy -o report_name.html -s scenario_name
install latest elixir for you os mix local.hex mix deps.get mix escript.build
MIX_ENV=test mix coveralls.html` `open cover/excoveralls.html`
create branch in github git fetch git checkout branch_name git push create pull request using github
create tests for your contribution run tests