sprotector_server (sbroker v1.1.1)

Server for storing the ask and ask_r queue min, max and drop probabilities for overload protection and short circuiting for a process with sprotector.

Link to this section Summary

Functions

Change the queue minimum to Min and maximum to Max, and update the queue length to Len and the drop probabilities to AskDrop and AskRDrop.

Register the local process Pid with the server with minimum message queue length Min and maximum message queue length Max. Lookup requests with sprotector will drop requests when above Max or with probabilities set by update/4 if above Min.

Unregister the process Pid with the server.

Update the queue length (Len), and ask and ask_r drop probabilities (AskDrop and AskRDrop) for Pid.

Link to this section Functions

Link to this function

change(Pid, Min, Max, Len, AskDrop, AskRDrop)

Specs

change(Pid, Min, Max, Len, AskDrop, AskRDrop) -> Result
          when
              Pid :: pid(),
              Min :: non_neg_integer(),
              Max :: non_neg_integer() | infinity,
              Len :: non_neg_integer(),
              AskDrop :: float(),
              AskRDrop :: float(),
              Result :: boolean().

Change the queue minimum to Min and maximum to Max, and update the queue length to Len and the drop probabilities to AskDrop and AskRDrop.

This function is an atomic. Returns true if the values were changed/updated, or false if Pid is not registered with the server.
Link to this function

register(Pid, Min, Max)

Specs

register(Pid, Min, Max) -> Result
            when
                Pid :: pid(),
                Min :: non_neg_integer(),
                Max :: non_neg_integer() | infinity,
                Result :: boolean().

Register the local process Pid with the server with minimum message queue length Min and maximum message queue length Max. Lookup requests with sprotector will drop requests when above Max or with probabilities set by update/4 if above Min.

Returns true if the process is successfully registered, or false if already registered.

A process must be registered to use update/4. Initial length and drop probabilites are set to 0 and 0.0. The server will synchronously link to the Pid.
Link to this function

unregister(Pid)

Specs

unregister(Pid) -> true when Pid :: pid().

Unregister the process Pid with the server.

The server will synchronously unlink from Pid.
Link to this function

update(Pid, Len, AskDrop, AskRDrop)

Specs

update(Pid, Len, AskDrop, AskRDrop) -> Result
          when
              Pid :: pid(),
              Len :: non_neg_integer(),
              AskDrop :: float(),
              AskRDrop :: float(),
              Result :: boolean().

Update the queue length (Len), and ask and ask_r drop probabilities (AskDrop and AskRDrop) for Pid.

Len must be an integer greater than or equal to 0.

AskDrop and AskRDrop should be floats, values below 0.0 are rounded to 0.0 and above 1.0 to 1.0.

Returns true if the values were updated, or false if Pid is not registered with the server.