Inspired by this post by Victor Martinez of WatchSumo.
% ./blitzy -n 100 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 protected]"
config :blitz, slave_nodes: [:"[email protected]",
:"[email protected]",
:"[email protected]"]
Here, the master node is :[email protected]
; 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 [email protected] -S mix
Now, when you run the the command
% ./blitzy -n 100 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:
17:03:30.600 [info] worker [[email protected]] completed in 5451.854 msecs
17:03:30.600 [info] worker [[email protected]] completed in 5258.639999999999 msecs
17:03:30.600 [info] worker [[email protected]] completed in 5272.281 msecs
17:03:30.600 [info] worker [[email protected]] completed in 5452.012 msecs
17:03:30.600 [info] worker [[email protected]] completed in 5258.318 msecs
17:03:30.600 [info] worker [[email protected]] completed in 5300.413 msecs
...
17:03:31.023 [info] worker [[email protected]] completed in 5653.303 msecs
Succeeded : 50
Failures : 0
Total time (msecs): 542665.9879999999
Avg time (msecs): 1629.6275915915912
17:03:31.024 [info] worker [[email protected]] completed in 5609.749 msecs
Succeeded : 50
Failures : 0
Total time (msecs): 485414.8010000001
Avg time (msecs): 1457.7021051051054
mix escript.build