#include <ClientInfo.h>
Classes | |
struct | Cutoff |
struct | Protocol |
Public Member Functions | |
ClientInfo (const Ip::Address &) | |
~ClientInfo () override | |
bool | hasQueue () const |
whether any clients are waiting for write quota More... | |
bool | hasQueue (const CommQuotaQueue *) const |
has a given queue More... | |
unsigned int | quotaEnqueue (int fd) |
client starts waiting in queue; create the queue if necessary More... | |
int | quotaPeekFd () const |
returns the next fd reservation More... | |
unsigned int | quotaPeekReserv () const |
returns the next reserv. to pop More... | |
void | quotaDequeue () |
pops queue head from queue More... | |
void | kickQuotaQueue () |
void | writeOrDequeue () |
either selects the head descriptor for writing or calls quotaDequeue() More... | |
int | quota () override |
allocate quota for a just dequeued client More... | |
bool | applyQuota (int &nleft, Comm::IoCallback *state) override |
void | scheduleWrite (Comm::IoCallback *state) override |
Will plan another write call. More... | |
void | onFdClosed () override |
Performs cleanup when the related file descriptor becomes closed. More... | |
void | reduceBucket (int len) override |
Decreases the bucket level. More... | |
void | quotaDumpQueue () |
dumps quota queue for debugging More... | |
void | setWriteLimiter (const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark) |
bool | noLimit () const |
Whether this bucket will not do bandwidth limiting. More... | |
Static Public Member Functions | |
static BandwidthBucket * | SelectBucket (fde *f) |
Public Attributes | |
Ip::Address | addr |
struct ClientInfo::Protocol | Http |
struct ClientInfo::Protocol | Icp |
struct ClientInfo::Cutoff | cutoff |
int | n_established |
time_t | last_seen |
bool | writeLimitingActive |
Is write limiter active. More... | |
bool | firstTimeConnection |
is this first time connection for this client More... | |
CommQuotaQueue * | quotaQueue |
clients waiting for more write quota More... | |
int | rationedQuota |
precomputed quota preserving fairness among clients More... | |
int | rationedCount |
number of clients that will receive rationedQuota More... | |
bool | eventWaiting |
waiting for commHandleWriteHelper event to fire More... | |
void * | key |
hash_link * | next |
double | bucketLevel |
how much can be written now More... | |
bool | selectWaiting |
is between commSetSelect and commHandleWrite More... | |
Protected Member Functions | |
void | refillBucket () |
Increases the bucket level with the writeSpeedLimit speed. More... | |
Protected Attributes | |
double | prevTime |
previous time when we checked More... | |
double | writeSpeedLimit |
Write speed limit in bytes per second. More... | |
double | bucketSizeLimit |
maximum bucket size More... | |
Private Member Functions | |
MEMPROXY_CLASS (ClientInfo) | |
Detailed Description
Definition at line 30 of file ClientInfo.h.
Constructor & Destructor Documentation
◆ ClientInfo()
|
explicit |
Definition at line 54 of file client_db.cc.
References addr, debugs, hash_link::key, MAX_IPSTRLEN, Ip::Address::toStr(), and xmalloc.
◆ ~ClientInfo()
|
override |
Definition at line 335 of file client_db.cc.
References debugs, hash_link::key, quotaQueue, and safe_free.
Member Function Documentation
◆ applyQuota()
|
overridevirtual |
Adjusts nleft to not exceed the current bucket quota value, if needed.
Reimplemented from BandwidthBucket.
Definition at line 1336 of file comm.cc.
References BandwidthBucket::applyQuota(), assert, Comm::IoCallback::conn, Comm::Connection::fd, hasQueue(), kickQuotaQueue(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), and Comm::IoCallback::quotaQueueReserv.
◆ hasQueue() [1/2]
bool ClientInfo::hasQueue | ( | ) | const |
Definition at line 1246 of file comm.cc.
References assert, CommQuotaQueue::empty(), and quotaQueue.
Referenced by applyQuota(), commHandleWriteHelper(), and kickQuotaQueue().
◆ hasQueue() [2/2]
bool ClientInfo::hasQueue | ( | const CommQuotaQueue * | q | ) | const |
Definition at line 1253 of file comm.cc.
References assert, and quotaQueue.
◆ kickQuotaQueue()
void ClientInfo::kickQuotaQueue | ( | ) |
schedule commHandleWriteHelper call
Definition at line 1292 of file comm.cc.
References BandwidthBucket::bucketLevel, commHandleWriteHelper(), eventAdd(), eventWaiting, hasQueue(), quotaQueue, and BandwidthBucket::selectWaiting.
Referenced by applyQuota(), onFdClosed(), reduceBucket(), and scheduleWrite().
◆ MEMPROXY_CLASS()
|
private |
◆ noLimit()
|
inlineinherited |
Definition at line 41 of file BandwidthBucket.h.
References BandwidthBucket::writeSpeedLimit.
Referenced by MessageBucket::quota(), BandwidthBucket::reduceBucket(), and BandwidthBucket::refillBucket().
◆ onFdClosed()
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1359 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::onFdClosed().
◆ quota()
|
overridevirtual |
calculates how much to write for a single dequeued client
Implements BandwidthBucket.
Definition at line 1305 of file comm.cc.
References BandwidthBucket::bucketLevel, debugs, last_seen, quotaQueue, rationedCount, rationedQuota, BandwidthBucket::refillBucket(), CommQuotaQueue::size(), and squid_curtime.
◆ quotaDequeue()
void ClientInfo::quotaDequeue | ( | ) |
removes queue head
Definition at line 1285 of file comm.cc.
References assert, CommQuotaQueue::dequeue(), and quotaQueue.
Referenced by applyQuota().
◆ quotaDumpQueue()
void ClientInfo::quotaDumpQueue | ( | ) |
◆ quotaEnqueue()
queues a given fd, creating the queue if necessary; returns reservation ID
Definition at line 1277 of file comm.cc.
References assert, CommQuotaQueue::enqueue(), and quotaQueue.
Referenced by applyQuota(), and scheduleWrite().
◆ quotaPeekFd()
int ClientInfo::quotaPeekFd | ( | ) | const |
returns the first descriptor to be dequeued
Definition at line 1261 of file comm.cc.
References assert, CommQuotaQueue::front(), and quotaQueue.
Referenced by applyQuota(), and writeOrDequeue().
◆ quotaPeekReserv()
unsigned int ClientInfo::quotaPeekReserv | ( | ) | const |
returns the reservation ID of the first descriptor to be dequeued
Definition at line 1269 of file comm.cc.
References assert, CommQuotaQueue::outs, and quotaQueue.
◆ reduceBucket()
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1367 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::reduceBucket().
◆ refillBucket()
|
protectedinherited |
Definition at line 31 of file BandwidthBucket.cc.
References BandwidthBucket::bucketLevel, BandwidthBucket::bucketSizeLimit, current_dtime, debugs, BandwidthBucket::noLimit(), BandwidthBucket::prevTime, and BandwidthBucket::writeSpeedLimit.
Referenced by quota(), and MessageBucket::quota().
◆ scheduleWrite()
|
overridevirtual |
Implements BandwidthBucket.
Definition at line 1350 of file comm.cc.
References Comm::IoCallback::conn, Comm::Connection::fd, kickQuotaQueue(), quotaEnqueue(), Comm::IoCallback::quotaQueueReserv, and writeLimitingActive.
◆ SelectBucket()
|
staticinherited |
Definition at line 95 of file BandwidthBucket.cc.
References fde::clientInfo, RefCount< C >::getRaw(), writeLimitingActive, and fde::writeQuotaHandler.
Referenced by _comm_close(), and Comm::IoCallback::selectOrQueueWrite().
◆ setWriteLimiter()
void ClientInfo::setWriteLimiter | ( | const int | aWriteSpeedLimit, |
const double | anInitialBurst, | ||
const double | aHighWatermark | ||
) |
Configure client write limiting (note:"client" here means - IP). It is called by httpAccept in client_side.cc, where the initial bucket size (anInitialBurst) computed, using the configured maximum bucket value and configured initial bucket value(50% by default).
- Parameters
-
writeSpeedLimit is speed limit configured in config for this pool initialBurst is initial bucket size to use for this client(i.e. client can burst at first) highWatermark is maximum bucket value
Definition at line 1376 of file comm.cc.
References assert, BandwidthBucket::bucketLevel, BandwidthBucket::bucketSizeLimit, current_dtime, debugs, firstTimeConnection, hash_link::key, BandwidthBucket::prevTime, quotaQueue, BandwidthBucket::selectWaiting, writeLimitingActive, and BandwidthBucket::writeSpeedLimit.
Referenced by ConnStateData::whenClientIpKnown().
◆ writeOrDequeue()
void ClientInfo::writeOrDequeue | ( | ) |
Definition at line 1224 of file comm.cc.
References assert, CallBack(), fd_table, head, quotaPeekFd(), and BandwidthBucket::selectWaiting.
Referenced by commHandleWriteHelper().
Member Data Documentation
◆ addr
Ip::Address ClientInfo::addr |
Definition at line 45 of file ClientInfo.h.
Referenced by ClientInfo(), client_entry(), clientdbDump(), and snmp_meshCtblFn().
◆ bucketLevel
|
inherited |
Definition at line 48 of file BandwidthBucket.h.
Referenced by kickQuotaQueue(), quota(), MessageBucket::quota(), BandwidthBucket::reduceBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ bucketSizeLimit
|
protectedinherited |
Definition at line 54 of file BandwidthBucket.h.
Referenced by BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ cutoff
struct ClientInfo::Cutoff ClientInfo::cutoff |
Referenced by clientdbCutoffDenied().
◆ eventWaiting
bool ClientInfo::eventWaiting |
Definition at line 75 of file ClientInfo.h.
Referenced by commHandleWriteHelper(), and kickQuotaQueue().
◆ firstTimeConnection
bool ClientInfo::firstTimeConnection |
Definition at line 70 of file ClientInfo.h.
Referenced by setWriteLimiter().
◆ Http
struct ClientInfo::Protocol ClientInfo::Http |
Referenced by clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
◆ Icp
struct ClientInfo::Protocol ClientInfo::Icp |
Referenced by clientdbCutoffDenied(), clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
◆ key
|
inherited |
Definition at line 19 of file hash.h.
Referenced by ClientInfo(), fqdncache_entry::fqdncache_entry(), IdleConnList::IdleConnList(), ipcache_entry::ipcache_entry(), net_db_name::net_db_name(), ~ClientInfo(), ExternalACLEntry::~ExternalACLEntry(), fqdncache_entry::~fqdncache_entry(), IdleConnList::~IdleConnList(), net_db_name::~net_db_name(), aclMatchExternal(), Rock::SwapDir::anchorToCache(), MemStore::anchorToCache(), Store::CheckSwapMetaKey(), StoreEntry::clearPublicKeyScope(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), destroyStoreEntry(), CommQuotaQueue::enqueue(), external_acl_cache_add(), StoreEntry::forcePublicKey(), fqdncacheAddEntry(), fqdncacheParse(), StoreEntry::getMD5Text(), hash_join(), hash_remove_link(), StoreEntry::hashDelete(), StoreEntry::hashInsert(), hashKeyStr(), Rock::SwapDir::hasReadableEntry(), htcpQuery(), idnsStartQuery(), ipcacheAddEntry(), ipcacheRelease(), Fs::Ufs::UFSSwapDir::logEntry(), Store::Controller::markedForDeletionAndAbandoned(), my_free(), ipcache_entry::name(), neighborsUdpPing(), netdbHashInsert(), Ipc::StoreMap::openForUpdating(), Store::PackFields(), peerCountMcastPeersCreateAndSend(), StoreEntry::publicKey(), read_passwd_file(), Ipc::StoreMapAnchor::set(), StoreEntry::setPrivateKey(), StoreEntry::setPublicKey(), setWriteLimiter(), Ident::Start(), MemStore::startCaching(), storeDigestAdd(), storeDigestDel(), storeRebuildParseEntry(), Store::UnpackIndexSwapMeta(), and UFSCleanLog::write().
◆ last_seen
time_t ClientInfo::last_seen |
Definition at line 67 of file ClientInfo.h.
Referenced by clientdbGC(), clientdbUpdate(), and quota().
◆ n_established
int ClientInfo::n_established |
Definition at line 66 of file ClientInfo.h.
Referenced by clientdbDump(), clientdbEstablished(), and clientdbGC().
◆ next
|
inherited |
Definition at line 20 of file hash.h.
Referenced by IdleConnList::IdleConnList(), clientdbGC(), Store::LocalSearch::copyBucket(), StoreEntry::dump(), hash_join(), hash_lookup(), hash_next(), hash_remove_link(), and lru_stats().
◆ prevTime
|
protectedinherited |
Definition at line 52 of file BandwidthBucket.h.
Referenced by BandwidthBucket::BandwidthBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
◆ quotaQueue
CommQuotaQueue* ClientInfo::quotaQueue |
Definition at line 72 of file ClientInfo.h.
Referenced by ~ClientInfo(), hasQueue(), kickQuotaQueue(), quota(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), quotaPeekReserv(), and setWriteLimiter().
◆ rationedCount
int ClientInfo::rationedCount |
Definition at line 74 of file ClientInfo.h.
Referenced by quota().
◆ rationedQuota
int ClientInfo::rationedQuota |
Definition at line 73 of file ClientInfo.h.
Referenced by quota().
◆ selectWaiting
|
inherited |
Definition at line 49 of file BandwidthBucket.h.
Referenced by commHandleWriteHelper(), kickQuotaQueue(), BandwidthBucket::onFdClosed(), setWriteLimiter(), and writeOrDequeue().
◆ writeLimitingActive
bool ClientInfo::writeLimitingActive |
Definition at line 69 of file ClientInfo.h.
Referenced by scheduleWrite(), BandwidthBucket::SelectBucket(), and setWriteLimiter().
◆ writeSpeedLimit
|
protectedinherited |
Definition at line 53 of file BandwidthBucket.h.
Referenced by BandwidthBucket::noLimit(), BandwidthBucket::refillBucket(), and setWriteLimiter().
The documentation for this class was generated from the following files:
- src/ClientInfo.h
- src/client_db.cc
- src/comm.cc