Copyright © 2013-2015 Zuse Institute Berlin
Version: $Id$
Behaviours: gen_component.
Authors: Ufuk Celebi (celebi@zib.de).
Auto-scaling service.
{autoscale, true} in scalaris.local.cfg will enable this service.
The main task of the autoscale is to manage a set of installed alarms by calling their alarm handlers periodically. Every alarm handler can request to add or remove VMs (see alarm_handler/2).
Alarms are read from the config as a list of alarm records: {autoscale_alarms, [{alarm, Name (req.), Options (opt.), Interval (opt.), Cooldown (opt.), State (opt.)}]}.
Every provided tuple corresponds to the alarm record type: - Name: the name of the alarm handler (should be unique) - Options: options are alarm handler specific (see alarm_handler/2) - Interval: interval between alarm checks in seconds - Cooldown: interval after a scale request - State: active or inactive
Example: {autoscale_alarms, [{alarm, rand_churn, [{lower_limit, -3}, {upper_limit, 10}], 60, 0, inactive}, {alarm, lat_avg, [], 60, 120, inactive}]}.
In this example, the rand_churn alarm handler is called every 60 seconds and configured with the options lower_limit and upper_limit. The lat_avg alarm handler is called every 60 seconds and falls back to the default options (set in the alarm handler), because no options are provided. If the lat_avg handler requested to add or remove VMs, the handler will be called after 120 seconds in order to allow the changes to take effect (cooldown).
VMs requests are handled by the cloud module. It can be configured with {autoscale_cloud_module, CloudModule}.
Possible modules are: cloud_local, cloud_ssh, and cloud_cps. For both cloud_local and cloud_ssh, scale requests are pushed by autoscale, for cloud_cps, autoscale expects pulling of requests.
cloud_cps is a dummy and not actually implemented as a module. Instead, the manager of the ConPaaS scalaris service needs to pull the current request via the JSON API.alarm() = #alarm{name = atom(), options = key_value_list(), interval = pos_integer(), cooldown = non_neg_integer(), state = active | inactive}
alarms() = [alarm()]
api_message() = {pull_scale_req, Pid :: pid()} | {unlock_scale_req, Pid :: pid()} | {toggle_alarm, Name :: atom(), Pid :: pid()} | {activate_alarms, Pid :: pid()} | {deactivate_alarms, Pid :: pid()}
key_value_list() = [{Key :: atom(), Value :: term()}]
message() = {get_state_response, MyRange :: intervals:interval()} | {check_alarm, Name :: atom()} | {push_scale_req} | api_message()
scale_req() = #scale_req{req = integer(), lock = locked | unlocked, mode = push | pull}
state() = {IsLeader :: boolean(), Alarms :: alarms(), ScaleReq :: scale_req(), Triggers :: triggers()}
triggers() = [{Name :: atom(), Trigger :: reference() | ok}]
check_config/0 | Checks whether config parameters exist and are valid. |
init/1 | |
on/2 | Set new leader state at startup and ring changes. |
rm_exec/5 | |
send_my_range_req/4 | Request my_range from dht_node (called by rm_loop at direct neighborhood changes). |
start_gen_component/5 | |
start_link/1 |
start_gen_component(Module :: module(), Handler :: gen_component:handler(), Args :: term(), Options :: [gen_component:option()], Self :: pid()) -> no_return() | ok
Set new leader state at startup and ring changes.
send_my_range_req(Pid :: pid(), Tag :: autoscale, _OldN :: nodelist:neighborhood(), _NewN :: nodelist:neighborhood()) -> ok
Request my_range from dht_node (called by rm_loop at direct neighborhood changes).
start_link(DHTNodeGroup :: pid_groups:groupname()) -> {ok, pid()}
init(X1 :: []) -> state()
check_config() -> boolean()
Checks whether config parameters exist and are valid.
rm_exec(Pid :: pid(), Tag :: autoscale, OldNeighbors :: nodelist:neighborhood(), NewNeighbors :: nodelist:neighborhood(), Reason :: rm_loop:reason()) -> ok
Generated by EDoc, Sep 11 2020, 15:26:07.