Current section
11 Versions
Jump to
Current section
11 Versions
Compare versions
24
files changed
+380
additions
-247
deletions
| @@ -2,17 +2,28 @@ | |
| 2 2 | [](https://github.com/esl/amoc/actions?query=workflow%3ACI) |
| 3 3 | [](https://hex.pm/packages/amoc) |
| 4 4 | [](https://hexdocs.pm/amoc/) |
| 5 | + [](https://codecov.io/github/esl/amoc) |
| 5 6 | |
| 6 7 | ---------------------------------------------------------------------------------------------- |
| 7 8 | A Murder of Crows, aka amoc, is a simple framework for running massively parallel tests in a distributed environment. |
| 8 9 | |
| 9 | - It can be used as a rebar3 dependency: |
| 10 | + It can be used as a `rebar3` dependency: |
| 10 11 | |
| 11 12 | ```erlang |
| 12 13 | {deps, [ |
| 13 | - {amoc, "3.0.0-rc1"} |
| 14 | + {amoc, "3.0.0"} |
| 14 15 | ]}. |
| 15 16 | ``` |
| 17 | + |
| 18 | + or in `mix`: |
| 19 | + ```elixir |
| 20 | + defp deps() do |
| 21 | + [ |
| 22 | + {:amoc, "~> 3.0"} |
| 23 | + ] |
| 24 | + end |
| 25 | + ``` |
| 26 | + |
| 16 27 | [MongooseIM](https://github.com/esl/MongooseIM) is continuously being load tested with Amoc. |
| 17 28 | All the XMPP scenarios can be found [here](https://github.com/esl/amoc-arsenal-xmpp). |
| 18 29 | |
| @@ -24,3 +35,7 @@ Before [setting up the distributed environment](guides/distributed.md), | |
| 24 35 | please read through the configuration overview. |
| 25 36 | |
| 26 37 | To see the full documentation, see [hexdocs](https://hexdocs.pm/amoc). |
| 38 | + |
| 39 | + You can also try with the livebook demo here: |
| 40 | + |
| 41 | + [](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fesl%2Famoc%2Fblob%2Fmaster%2Fguides%2Famoc_livebook.livemd) |
| @@ -17,7 +17,7 @@ | |
| 17 17 | <<"src/amoc_coordinator/amoc_coordinator_worker.erl">>, |
| 18 18 | <<"src/amoc_distribution">>,<<"src/amoc_distribution/amoc_cluster.erl">>, |
| 19 19 | <<"src/amoc_distribution/amoc_dist.erl">>,<<"src/amoc_scenario.erl">>, |
| 20 | - <<"src/amoc_sup.erl">>,<<"src/amoc_throttle">>, |
| 20 | + <<"src/amoc_sup.erl">>,<<"src/amoc_telemetry.erl">>,<<"src/amoc_throttle">>, |
| 21 21 | <<"src/amoc_throttle/amoc_throttle.erl">>, |
| 22 22 | <<"src/amoc_throttle/amoc_throttle_controller.erl">>, |
| 23 23 | <<"src/amoc_throttle/amoc_throttle_process.erl">>,<<"src/amoc_user.erl">>, |
| @@ -30,4 +30,4 @@ | |
| 30 30 | [{<<"app">>,<<"telemetry">>}, |
| 31 31 | {<<"optional">>,false}, |
| 32 32 | {<<"requirement">>,<<"1.2.1">>}]}]}. |
| 33 | - {<<"version">>,<<"3.0.0-rc3">>}. |
| 33 | + {<<"version">>,<<"3.0.0">>}. |
| @@ -9,6 +9,7 @@ | |
| 9 9 | |
| 10 10 | {profiles, [ |
| 11 11 | {test, [ |
| 12 | + {plugins, [{rebar3_codecov, "0.6.0"}]}, |
| 12 13 | {deps, [ |
| 13 14 | {meck, "0.9.2"}, |
| 14 15 | {proper, "1.4.0"}, |
| @@ -57,6 +58,7 @@ | |
| 57 58 | {'guides/telemetry.md', #{title => <<"Telemetry events">>}}, |
| 58 59 | {'guides/throttle.md', #{title => <<"Amoc throttle">>}}, |
| 59 60 | {'guides/coordinator.md', #{title => <<"Amoc coordinator">>}}, |
| 61 | + {'guides/amoc_livebook.livemd', #{title => <<"Livebook tutorial">>}}, |
| 60 62 | {'LICENSE', #{title => <<"License">>}} |
| 61 63 | ]}, |
| 62 64 | {assets, <<"guides/assets">>}, |
| @@ -1,6 +1,6 @@ | |
| 1 1 | {application,amoc, |
| 2 2 | [{description,"A Murder of Crows"}, |
| 3 | - {vsn,"3.0.0-rc3"}, |
| 3 | + {vsn,"3.0.0"}, |
| 4 4 | {registered,[]}, |
| 5 5 | {applications,[kernel,stdlib,compiler,telemetry]}, |
| 6 6 | {mod,{amoc_app,[]}}, |
| @@ -1,21 +1,20 @@ | |
| 1 | - %%============================================================================== |
| 2 | - %% Copyright 2023 Erlang Solutions Ltd. |
| 3 | - %% Licensed under the Apache License, Version 2.0 (see LICENSE file) |
| 4 | - %%============================================================================== |
| 1 | + %% @copyright 2023 Erlang Solutions Ltd. |
| 2 | + %% @doc API module for running locally, in a non-distributed environment |
| 3 | + %% |
| 4 | + %% Use `amoc_dist' module to run scenarios in a distributed environment |
| 5 | + %% @end |
| 5 6 | -module(amoc). |
| 6 7 | |
| 7 8 | -export([do/3, |
| 8 9 | add/1, |
| 9 10 | remove/2, |
| 10 | - stop/0]). |
| 11 | + stop/0, |
| 12 | + reset/0]). |
| 11 13 | |
| 12 | - -export_type([scenario/0]). |
| 13 14 | -type scenario() :: module(). |
| 15 | + -export_type([scenario/0]). |
| 14 16 | |
| 15 | - %% ------------------------------------------------------------------ |
| 16 | - %% API for the local scenario execution, use amoc_dist module to run |
| 17 | - %% scenarios in a distributed environment |
| 18 | - %% ------------------------------------------------------------------ |
| 17 | + %% @doc Start a scenario with the given number of users and configuration |
| 19 18 | -spec do(scenario(), non_neg_integer(), amoc_config:settings()) -> |
| 20 19 | ok | {error, term()}. |
| 21 20 | do(Scenario, Count, Settings) -> |
| @@ -31,6 +30,7 @@ do(Scenario, Count, Settings) -> | |
| 31 30 | Error -> Error |
| 32 31 | end. |
| 33 32 | |
| 33 | + %% @doc Dynamically add more users to a currently running scenario |
| 34 34 | -spec add(pos_integer()) -> ok | {error, any()}. |
| 35 35 | add(Count) when is_integer(Count), Count > 0 -> |
| 36 36 | case is_running_locally() of |
| @@ -40,6 +40,11 @@ add(Count) when is_integer(Count), Count > 0 -> | |
| 40 40 | Error -> Error |
| 41 41 | end. |
| 42 42 | |
| 43 | + %% @doc Dynamically remove more users from a currently running scenario, optionally forcibly |
| 44 | + %% |
| 45 | + %% Forcing user removal means that all users will be signal to exit in parallel, |
| 46 | + %% and will forcibly be killed after a short timeout (2 seconds), |
| 47 | + %% whether they have exited already or not. |
| 43 48 | -spec remove(pos_integer(), boolean()) -> {ok, non_neg_integer()} | {error, any()}. |
| 44 49 | remove(Count, ForceRemove) when is_integer(Count), Count > 0 -> |
| 45 50 | case is_running_locally() of |
| @@ -48,6 +53,7 @@ remove(Count, ForceRemove) when is_integer(Count), Count > 0 -> | |
| 48 53 | Error -> Error |
| 49 54 | end. |
| 50 55 | |
| 56 | + %% @doc Stop a running scenario |
| 51 57 | -spec stop() -> ok | {error, any()}. |
| 52 58 | stop() -> |
| 53 59 | case is_running_locally() of |
| @@ -56,6 +62,18 @@ stop() -> | |
| 56 62 | Error -> Error |
| 57 63 | end. |
| 58 64 | |
| 65 | + %% @doc Restart the whole amoc supervision tree |
| 66 | + -spec reset() -> ok | {error, term()}. |
| 67 | + reset() -> |
| 68 | + case is_running_locally() of |
| 69 | + ok -> |
| 70 | + application:stop(?MODULE), |
| 71 | + application:ensure_all_started(?MODULE), |
| 72 | + ok; |
| 73 | + Error -> |
| 74 | + Error |
| 75 | + end. |
| 76 | + |
| 59 77 | %% ------------------------------------------------------------------ |
| 60 78 | %% Local functions |
| 61 79 | %% ------------------------------------------------------------------ |
Loading more files…