More...

#include <Incoming.h>

Collaboration diagram for Comm::Incoming:

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
 

Detailed Description

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.

Returns
whether it is time to check incoming sockets.

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.

Member Function Documentation

◆ check()

bool Comm::Incoming::check ( )
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.

Returns
whether it is time to check incoming sockets.

Definition at line 86 of file Incoming.h.

References Factor, interval, and ioEvents.

◆ finishPolling()

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().

◆ init()

void Comm::Incoming::init ( int  n)
inline

Definition at line 59 of file Incoming.h.

References StatHist::enumInit(), history, and nMaximum.

◆ startPolling()

bool Comm::Incoming::startPolling ( int  n)
inline

Preparation for polling incoming sockets.

Parameters
nthe number of relevant listening FDs currently open.
Returns
whether it is possible to check with poll(2)/select(2).

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().

Member Data Documentation

◆ Factor

const int Comm::Incoming::Factor = INCOMING_FACTOR
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(), and commIncomingStats().

◆ history

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(), finishPolling(), and init().

◆ interval

int Comm::Incoming::interval = (16 << Factor)

Definition at line 96 of file Incoming.h.

Referenced by check(), commIncomingStats(), and finishPolling().

◆ ioEvents

int Comm::Incoming::ioEvents = 0
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().

◆ MaxInterval

const int Comm::Incoming::MaxInterval = (256 << Factor)
static

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().

◆ nMaximum

int Comm::Incoming::nMaximum = 0
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().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors