# Module lb_psv_gossip

- Description
- Data Types
- Function Index
- Function Details

Passive load balancing using gossip to sample O(log(N)) nodes (at least lb_psv_samples samples) and choose the one that reduces the standard deviation the most.

Copyright © 2010-2012 Zuse Institute Berlin

Version: $Id$

Behaviours: `lb_psv_beh`.

Authors: Nico Kruber (`kruber@zib.de`).

## Description

Passive load balancing using gossip to sample O(log(N)) nodes (at least lb_psv_samples samples) and choose the one that reduces the standard deviation the most. If there is no load address ranges are split according to lb_psv_split_fallback, i.e. in halves or using the selected keys, otherwise no more load is moved than is needed to have the average load on one of the two nodes.

## Data Types

### custom_message()

    custom_message() =
        {gossip_get_values_best_response, gossip_load:load_info()} |
        {get_split_key_response,
         SplitKey :: {rt_chord:key(), TakenLoad :: non_neg_integer()}}

## Function Index

check_config/0 | Checks whether config parameters of the passive load balancing algorithm exist and are valid.
create_join/4 | Creates a join operation if a node would join at my node with the given key.
get_number_of_samples/1 | Gets the number of IDs to sample during join.
get_number_of_samples_remote/2 | Sends the number of IDs to sample during join to the joining node.
process_join_msg/3 |
sort_candidates/1 | Sorts all provided operations so that the one with the biggest change of the standard deviation is at the front.

## Function Details

### get_number_of_samples/1

    get_number_of_samples(Conn :: dht_node_join:connection()) -> ok

Gets the number of IDs to sample during join. Note: this is executed at the joining node.

### get_number_of_samples_remote/2

    get_number_of_samples_remote(SourcePid :: comm:mypid(),
                                 Conn :: dht_node_join:connection()) ->
                                    ok

Sends the number of IDs to sample during join to the joining node. Note: this is executed at the existing node.

### create_join/4

    create_join(DhtNodeState :: dht_node_state:state(),
                SelectedKey :: rt_chord:key(),
                SourcePid :: comm:mypid(),
                Conn :: dht_node_join:connection()) ->
                   dht_node_state:state()

Creates a join operation if a node would join at my node with the given key. This will simulate the join operation and return a lb_op() with all the data needed in sort_candidates/1. Note: this is executed at an existing node.

### sort_candidates/1

    sort_candidates(Ops :: [lb_op:lb_op()]) -> [lb_op:lb_op()]

Sorts all provided operations so that the one with the biggest change of the standard deviation is at the front. In case of no load changes, the operation with the largest address range at the joining node will be at the front. Note: this is executed at the joining node.

### process_join_msg/3

    process_join_msg(X1 :: custom_message(),
                     X2 ::
                         {get_samples,
                          SourcePid :: comm:mypid(),
                          Conn :: dht_node_join:connection()} |
                         {create_join2,
                          SelectedKey :: rt_chord:key(),
                          SourcePid :: comm:mypid(),
                          Conn :: dht_node_join:connection()} |
                         {create_join3,
                          SelectedKey :: rt_chord:key(),
                          SourcePid :: comm:mypid(),
                          BestValues :: gossip_load:load_info(),
                          Conn :: dht_node_join:connection()},
                     DhtNodeState :: dht_node_state:state()) ->
                        dht_node_state:state()

### check_config/0

    check_config() -> boolean()

Checks whether config parameters of the passive load balancing algorithm exist and are valid.

Generated by EDoc, Apr 22 2017, 15:58:21.