View Source Running locally

Test your scenario locally

Everything you need to do is to create the release. To achieve that run: make rel. Now you are ready to test our scenario locally with one Amoc node; to start the node run _build/default/rel/amoc/bin/amoc console.

Start my_scenario spawning 10 amoc users with IDs from range (1,10) inclusive.

amoc:do(my_scenario, 10, []).
:amoc.do(:my_scenario, 10, [])

Add 10 more user sessions.

amoc:add(10).
:amoc.add(10)

Remove 10 users.

amoc:remove(10, true).
:amoc.remove(10, true)

Note that removal operation is asynchronous, and if we call amoc_controller:remove_users/2 two times in a row, it may select the same users for removal.

Also note that all the user processes trap exits.

Many independent Amoc nodes

Sometimes a need arises to run several Amoc nodes independently from each other. In this case we would like to be able to run different ranges of user ids on every node. To do so, the following trick could be applied:

  1. amoc:start(my_scenario, 0, []).
  2. amoc_controller:add_users(StartId, StopId).

NODE: in case of independent Amoc nodes, it's also possible to run different scenarios on different nodes.