|
Squid Web Cache master
|
#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 | |
| bool | hasQueue (const CommQuotaQueue *) const |
| has a given queue | |
| unsigned int | quotaEnqueue (int fd) |
| client starts waiting in queue; create the queue if necessary | |
| int | quotaPeekFd () const |
| returns the next fd reservation | |
| unsigned int | quotaPeekReserv () const |
| returns the next reservation to pop | |
| void | quotaDequeue () |
| pops queue head from queue | |
| void | kickQuotaQueue () |
| void | writeOrDequeue () |
| either selects the head descriptor for writing or calls quotaDequeue() | |
| int | quota () override |
| allocate quota for a just dequeued client | |
| bool | applyQuota (int &nleft, Comm::IoCallback *state) override |
| void | scheduleWrite (Comm::IoCallback *state) override |
| Will plan another write call. | |
| void | onFdClosed () override |
| Performs cleanup when the related file descriptor becomes closed. | |
| void | reduceBucket (int len) override |
| Decreases the bucket level. | |
| void | quotaDumpQueue () |
| dumps quota queue for debugging | |
| void | setWriteLimiter (const int aWriteSpeedLimit, const double anInitialBurst, const double aHighWatermark) |
| bool | noLimit () const |
| Whether this bucket will not do bandwidth limiting. | |
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. | |
| bool | firstTimeConnection |
| is this first time connection for this client | |
| CommQuotaQueue * | quotaQueue |
| clients waiting for more write quota | |
| int | rationedQuota |
| precomputed quota preserving fairness among clients | |
| int | rationedCount |
| number of clients that will receive rationedQuota | |
| bool | eventWaiting |
| waiting for commHandleWriteHelper event to fire | |
| void * | key |
| hash_link * | next |
| double | bucketLevel |
| how much can be written now | |
| bool | selectWaiting |
| is between commSetSelect and commHandleWrite | |
Protected Member Functions | |
| void | refillBucket () |
| Increases the bucket level with the writeSpeedLimit speed. | |
Protected Attributes | |
| double | prevTime |
| previous time when we checked | |
| double | writeSpeedLimit |
| Write speed limit in bytes per second. | |
| double | bucketSizeLimit |
| maximum bucket size | |
Private Member Functions | |
| MEMPROXY_CLASS (ClientInfo) | |
Definition at line 30 of file ClientInfo.h.
|
explicit |
Definition at line 54 of file client_db.cc.
References addr, debugs, hash_link::key, MAX_IPSTRLEN, Ip::Address::toStr(), and xmalloc.
|
override |
Definition at line 335 of file client_db.cc.
References debugs, hash_link::key, quotaQueue, and safe_free.
|
overridevirtual |
Adjusts nleft to not exceed the current bucket quota value, if needed.
Reimplemented from BandwidthBucket.
Definition at line 1303 of file comm.cc.
References BandwidthBucket::applyQuota(), assert, Comm::IoCallback::conn, Comm::Connection::fd, hasQueue(), kickQuotaQueue(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), and Comm::IoCallback::quotaQueueReserv.
| bool ClientInfo::hasQueue | ( | ) | const |
Definition at line 1213 of file comm.cc.
References assert, CommQuotaQueue::empty(), and quotaQueue.
Referenced by applyQuota(), commHandleWriteHelper(), and kickQuotaQueue().
| bool ClientInfo::hasQueue | ( | const CommQuotaQueue * | q | ) | const |
Definition at line 1220 of file comm.cc.
References assert, and quotaQueue.
| void ClientInfo::kickQuotaQueue | ( | ) |
schedule commHandleWriteHelper call
Definition at line 1259 of file comm.cc.
References BandwidthBucket::bucketLevel, commHandleWriteHelper(), eventAdd(), eventWaiting, hasQueue(), quotaQueue, and BandwidthBucket::selectWaiting.
Referenced by applyQuota(), onFdClosed(), reduceBucket(), and scheduleWrite().
|
private |
|
inlineinherited |
Definition at line 41 of file BandwidthBucket.h.
References BandwidthBucket::writeSpeedLimit.
Referenced by MessageBucket::quota(), BandwidthBucket::reduceBucket(), and BandwidthBucket::refillBucket().
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1326 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::onFdClosed().
|
overridevirtual |
calculates how much to write for a single dequeued client
Implements BandwidthBucket.
Definition at line 1272 of file comm.cc.
References BandwidthBucket::bucketLevel, debugs, last_seen, quotaQueue, rationedCount, rationedQuota, BandwidthBucket::refillBucket(), CommQuotaQueue::size(), and squid_curtime.
| void ClientInfo::quotaDequeue | ( | ) |
removes queue head
Definition at line 1252 of file comm.cc.
References assert, CommQuotaQueue::dequeue(), and quotaQueue.
Referenced by applyQuota().
| void ClientInfo::quotaDumpQueue | ( | ) |
queues a given fd, creating the queue if necessary; returns reservation ID
Definition at line 1244 of file comm.cc.
References assert, CommQuotaQueue::enqueue(), and quotaQueue.
Referenced by applyQuota(), and scheduleWrite().
| int ClientInfo::quotaPeekFd | ( | ) | const |
returns the first descriptor to be dequeued
Definition at line 1228 of file comm.cc.
References assert, CommQuotaQueue::front(), and quotaQueue.
Referenced by applyQuota(), and writeOrDequeue().
| unsigned int ClientInfo::quotaPeekReserv | ( | ) | const |
returns the reservation ID of the first descriptor to be dequeued
Definition at line 1236 of file comm.cc.
References assert, CommQuotaQueue::outs, and quotaQueue.
|
overridevirtual |
Reimplemented from BandwidthBucket.
Definition at line 1334 of file comm.cc.
References kickQuotaQueue(), and BandwidthBucket::reduceBucket().
|
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().
|
overridevirtual |
Implements BandwidthBucket.
Definition at line 1317 of file comm.cc.
References Comm::IoCallback::conn, Comm::Connection::fd, kickQuotaQueue(), quotaEnqueue(), Comm::IoCallback::quotaQueueReserv, and writeLimitingActive.
|
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().
| 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).
| 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 1343 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().
| void ClientInfo::writeOrDequeue | ( | ) |
Definition at line 1191 of file comm.cc.
References assert, CallBack(), fd_table, head, quotaPeekFd(), and BandwidthBucket::selectWaiting.
Referenced by commHandleWriteHelper().
| Ip::Address ClientInfo::addr |
Definition at line 45 of file ClientInfo.h.
Referenced by ClientInfo(), client_entry(), clientdbDump(), and snmp_meshCtblFn().
|
inherited |
Definition at line 48 of file BandwidthBucket.h.
Referenced by kickQuotaQueue(), quota(), MessageBucket::quota(), BandwidthBucket::reduceBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
|
protectedinherited |
Definition at line 54 of file BandwidthBucket.h.
Referenced by BandwidthBucket::refillBucket(), and setWriteLimiter().
| struct ClientInfo::Cutoff ClientInfo::cutoff |
Referenced by clientdbCutoffDenied().
| bool ClientInfo::eventWaiting |
Definition at line 75 of file ClientInfo.h.
Referenced by commHandleWriteHelper(), and kickQuotaQueue().
| bool ClientInfo::firstTimeConnection |
Definition at line 70 of file ClientInfo.h.
Referenced by setWriteLimiter().
| struct ClientInfo::Protocol ClientInfo::Http |
Referenced by clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
| struct ClientInfo::Protocol ClientInfo::Icp |
Referenced by clientdbCutoffDenied(), clientdbDump(), clientdbGC(), clientdbUpdate(), and snmp_meshCtblFn().
|
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(), ACLExternal::aclMatchExternal(), Rock::SwapDir::anchorToCache(), MemStore::anchorToCache(), Store::CheckSwapMetaKey(), StoreEntry::clearPublicKeyScope(), Rock::SwapDir::createStoreIO(), CommQuotaQueue::dequeue(), 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(), MemStore::startCaching(), storeDigestAdd(), storeDigestDel(), storeGetPublic(), storeRebuildParseEntry(), Store::UnpackIndexSwapMeta(), and UFSCleanLog::write().
| time_t ClientInfo::last_seen |
Definition at line 67 of file ClientInfo.h.
Referenced by clientdbGC(), clientdbUpdate(), and quota().
| int ClientInfo::n_established |
Definition at line 66 of file ClientInfo.h.
Referenced by clientdbDump(), clientdbEstablished(), and clientdbGC().
|
inherited |
Definition at line 20 of file hash.h.
Referenced by IdleConnList::IdleConnList(), clientdbGC(), Store::LocalSearch::copyBucket(), StoreEntry::dump(), hash_join(), hash_next(), and hash_remove_link().
|
protectedinherited |
Definition at line 52 of file BandwidthBucket.h.
Referenced by BandwidthBucket::BandwidthBucket(), BandwidthBucket::refillBucket(), and setWriteLimiter().
| CommQuotaQueue* ClientInfo::quotaQueue |
Definition at line 72 of file ClientInfo.h.
Referenced by ~ClientInfo(), hasQueue(), hasQueue(), kickQuotaQueue(), quota(), quotaDequeue(), quotaEnqueue(), quotaPeekFd(), quotaPeekReserv(), and setWriteLimiter().
| int ClientInfo::rationedCount |
Definition at line 74 of file ClientInfo.h.
Referenced by quota().
| int ClientInfo::rationedQuota |
Definition at line 73 of file ClientInfo.h.
Referenced by quota().
|
inherited |
Definition at line 49 of file BandwidthBucket.h.
Referenced by checkTimeouts(), commHandleWriteHelper(), kickQuotaQueue(), BandwidthBucket::onFdClosed(), MessageBucket::scheduleWrite(), setWriteLimiter(), and writeOrDequeue().
| bool ClientInfo::writeLimitingActive |
Definition at line 69 of file ClientInfo.h.
Referenced by scheduleWrite(), BandwidthBucket::SelectBucket(), and setWriteLimiter().
|
protectedinherited |
Definition at line 53 of file BandwidthBucket.h.
Referenced by BandwidthBucket::noLimit(), BandwidthBucket::refillBucket(), and setWriteLimiter().