1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
.TH overload 3 "sasl 2.1.5.3" "Ericsson AB" "ERLANG MODULE DEFINITION"
.SH MODULE
overload \- An Overload Regulation Process
.SH DESCRIPTION
.LP
\fIoverload\fR is a process which indirectly regulates CPU usage in the system\&. The idea is that a main application calls the \fIrequest/0\fR function before starting a major job, and proceeds with the job if the return value is positive; otherwise the job must not be started\&.
.LP
\fIoverload\fR is part of the \fIsasl\fR application, and all configuration parameters are defined there\&.
.LP
A set of two intensities are maintained, the \fItotal intensity\fR and the \fIaccept intensity\fR\&. For that purpose there are two configuration parameters, the \fIMaxIntensity\fR and the \fIWeight\fR value (both are measured in 1/second)\&.
.LP
Then total and accept intensities are calculated as follows\&. Assume that the time of the current call to \fIrequest/0\fR is \fIT(n)\fR, and that the time of the previous call was \fIT(n-1)\fR\&.
.RS 2
.TP 2
*
The current \fItotal intensity\fR, denoted \fITI(n)\fR, is calculated according to the formula,
.RS 2
.LP
.LP
\fITI(n) = exp(-Weight*(T(n) - T(n-1)) * TI(n-1) + Weight\fR,
.LP
.LP
where \fITI(n-1)\fR is the previous total intensity\&.
.RE
.TP 2
*
The current \fIaccept intensity\fR, denoted \fIAI(n)\fR, is determined by the formula,
.RS 2
.LP
.LP
\fIAI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1) + Weight\fR,
.LP
.LP
where \fIAI(n-1)\fR is the previous accept intensity, provided that the value of \fIexp(-Weight*(T(n) - T(n-1)) * AI(n-1)\fR is less than \fIMaxIntensity\fR; otherwise the value is
.LP
.LP
\fIAI(n) = exp(-Weight*(T(n) - T(n-1)) * AI(n-1)\fR\&.
.RE
.RE
.LP
The value of configuration parameter \fIWeight\fR controls the speed with which the calculations of intensities will react to changes in the underlying input intensity\&. The inverted value of \fIWeight\fR,
.LP
\fIT = 1/Weight\fR
.LP
can be thought of as the "time constant" of the intensity calculation formulas\&. For example, if \fIWeight = 0\&.1\fR, then a change in the underlying input intensity will be reflected in the \fItotal\fR and \fIaccept intensities\fR within approximately 10 seconds\&.
.LP
The overload process defines one alarm, which it sets using \fIalarm_handler:set_alarm(Alarm)\fR\&. \fIAlarm\fR is defined as:
.RS 2
.TP 4
.B
\fI{overload, []}\fR:
This alarm is set when the current accept intensity exceeds \fIMaxIntensity\fR\&.
.RE
.LP
A new overload alarm is not set until the current accept intensity has fallen below \fIMaxIntensity\fR\&. To prevent the overload process from generating a lot of set/reset alarms, the alarm is not reset until the current accept intensity has fallen below 75% of \fIMaxIntensity\fR, and it is not until then that the alarm can be set again\&.
.SH EXPORTS
.LP
.B
request() -> accept | reject
.br
.RS
.LP
Returns \fIaccept\fR or \fIreject\fR depending on the current value of the accept intensity\&.
.LP
The application calling this function should be processed with the job in question if the return value is \fIaccept\fR; otherwise it should not continue with that job\&.
.RE
.LP
.B
get_overload_info() -> OverloadInfo
.br
.RS
.TP
Types
OverloadInfo = [{total_intensity, TotalIntensity}, {accept_intensity, AcceptIntensity}, {max_intensity, MaxIntensity}, {weight, Weight}, {total_requests, TotalRequests}, {accepted_requests, AcceptedRequests}]\&.
.br
TotalIntensity = float() > 0
.br
AcceptIntensity = float() > 0
.br
MaxIntensity = float() > 0
.br
Weight = float() > 0
.br
TotalRequests = integer()
.br
AcceptedRequests = integer()
.br
.RE
.RS
.LP
Returns the current total and accept intensities, the configuration parameters, and absolute counts of the total number of requests, and accepted number of requests (since the overload process was started)\&.
.RE
.SH SEE ALSO
.LP
alarm_handler(3), sasl(3)
|