|
Squid Web Cache master
|
#include <Incoming.h>
Public Member Functions | |
| void | init (int n) |
| bool | startPolling (int n) |
| void | finishPolling (int, SquidConfig::CommIncoming::Measure &) |
| bool | check () |
Public Attributes | |
| int | interval = (16 << Factor) |
| StatHist | history |
Static Public Attributes | |
| static const int | Factor = INCOMING_FACTOR |
| static const int | MaxInterval = (256 << Factor) |
Private Attributes | |
| int | ioEvents = 0 |
| int | nMaximum = 0 |
Automatic tuning for incoming requests.
INCOMING sockets are the listening ports for transport protocols. We need to check these fairly regularly, but how often? When the load increases, we want to check the incoming sockets more often. If we have a lot of one protocol incoming, then we need to check those sockets more than others.
Every time we check incoming sockets, we count how many new messages or connections were processed. This is used to adjust the interval for the next iteration.
Finalize and update records when incoming sockets polled.
The new interval is calculated as the current interval, plus what we would like to see as an average number of events, minus the number of events just processed.
Caveats:
The higher the INCOMING_FACTOR, the slower the algorithm will respond to load spikes/increases/decreases in demand. A value between 3 and 8 is recommended.
Magic upper limit on interval. At the largest value the cache will effectively be idling.
Definition at line 39 of file Incoming.h.
|
inline |
Every time we check incoming sockets, we count how many new messages or connections were processed. This is used to adjust the interval for the next iteration.
Definition at line 86 of file Incoming.h.
| void Comm::Incoming::finishPolling | ( | int | n, |
| SquidConfig::CommIncoming::Measure & | cfg | ||
| ) |
Finalize and update records when incoming sockets polled.
The new interval is calculated as the current interval, plus what we would like to see as an average number of events, minus the number of events just processed.
Definition at line 15 of file Incoming.cc.
References SquidConfig::CommIncoming::Measure::average, StatHist::count(), history, interval, MaxInterval, SquidConfig::CommIncoming::Measure::min_poll, and nMaximum.
Referenced by comm_poll_dns_incoming(), comm_poll_tcp_incoming(), comm_poll_udp_incoming(), comm_select_dns_incoming(), comm_select_tcp_incoming(), and comm_select_udp_incoming().
|
inline |
Definition at line 59 of file Incoming.h.
References StatHist::enumInit(), history, and nMaximum.
Referenced by statCountersInitSpecial().
|
inline |
Preparation for polling incoming sockets.
| n | the number of relevant listening FDs currently open. |
Definition at line 68 of file Incoming.h.
References ioEvents.
Referenced by comm_poll_dns_incoming(), comm_poll_tcp_incoming(), comm_poll_udp_incoming(), comm_select_dns_incoming(), comm_select_tcp_incoming(), and comm_select_udp_incoming().
|
static |
The higher the INCOMING_FACTOR, the slower the algorithm will respond to load spikes/increases/decreases in demand. A value between 3 and 8 is recommended.
Definition at line 50 of file Incoming.h.
Referenced by check(), commIncomingStats(), and commIncomingStats().
| StatHist Comm::Incoming::history |
History of I/O events timing on listening ports.
You can see the current values of the interval's, as well as histograms of 'incoming_events' in the cache manager 'comm_*_incoming' reports.
Definition at line 104 of file Incoming.h.
Referenced by commIncomingStats(), commIncomingStats(), finishPolling(), and init().
Definition at line 96 of file Incoming.h.
Referenced by check(), commIncomingStats(), commIncomingStats(), and finishPolling().
|
private |
Count of normal I/O events processed since last call to startPolling(). When ioEvents > interval, it is time to check incoming sockets again.
Definition at line 112 of file Incoming.h.
Referenced by check(), and startPolling().
Magic upper limit on interval. At the largest value the cache will effectively be idling.
Definition at line 56 of file Incoming.h.
Referenced by finishPolling().
|
private |
Maximum value to record for number of I/O events within an interval. Set using init(N).
Definition at line 118 of file Incoming.h.
Referenced by finishPolling(), and init().