]> git.ipfire.org Git - thirdparty/squid.git/commit - src/client_side.cc
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 25 Oct 2010 18:25:19 +0000 (21:25 +0300)
committerChristos Tsantilas <chtsanti@users.sourceforge.net>
Mon, 25 Oct 2010 18:25:19 +0000 (21:25 +0300)
commitb4cd430a2d6dcd470e61f39deee6cab0681b74a6
tree42ad0ae729f40b7842e118e187642d4d440c4b80
parente2f4c66a858675c0737d656a687b1c0c2a1c6561
Author: Alex Rousskov <rousskov@measurement-factory.com>
Client-side bandwidth limit (a.k.a., quota or delay pool) implementation.

In mobile environments, Squid may need to limit Squid-to-client bandwidth
available to individual users, identified by their IP addresses. The IP
address pool can be as large as a /10 IPv4 network (4 million unique IP
addresses) and even larger in IPv6 environments. On the other hand, the code
should support thousands of connections coming from a single IP (e.g., a child
proxy).

The implementation is based on storing bandwidth-related "bucket" information
in the existing "client database" hash (client_db.cc). The old code already
assigned each client IP a single ClientInfo object, which satisfies the
client-side IP-based bandwidth pooling requirements. The old hash size is
increased to support up to 32K concurrent clients if needed.

Client-side pools are configured similarly to server-side ones, but there is
only one pool class. See client_delay_pools,
client_delay_initial_bucket_level, client_delay_parameters, and
client_delay_access in squid.conf. The client_delay_access matches the client
with delay parameters. It does not pool clients from different IP addresses
together.

Special care is taken to provide fair distribution of bandwidth among clients
sharing the same bucket (i.e., clients coming from the same IP address).
Multiple same-IP clients competing for bandwidth are queued using FIFO
algorithm. If a bucket becomes empty, the first client among those sharing the
bucket is delayed by 1 second before it can attempt to receive more response
data from Squid.  This delay may need to be lowered in high-bandwidth
environments.

This feature has been documented at
http://wiki.squid-cache.org/Features/ClientBandwidthLimit
13 files changed:
doc/release-notes/release-3.3.sgml
src/ClientInfo.h
src/Makefile.am
src/cache_cf.cc
src/cf.data.depend
src/cf.data.pre
src/client_db.cc
src/client_side.cc
src/comm.cc
src/fde.h
src/main.cc
src/protos.h
src/structs.h