Re: [squid-users] Delay Pools question

From: Chris Robertson <crobertson_at_gci.net>
Date: Wed, 13 Aug 2008 14:42:19 -0800

Odin Ali wrote:
> Hello All,
>
> I would like to configure delay pools to grant 512kbps of bandwidth to
> an entire network of users and I would like each connection to share
> the 512kbps if the file they are downloading is less than 10Meg but to
> have the connection throttled to 80kbps if the file is greater than
> 10Meg.
>
> How do I accomplish this?
>
> Here is what I'm currently using:
>
> acl Staff_networks src 10.0.0.0/255.0.0.0
> delay_pools 1
> delay_class 1 2
> delay_parameters 2 64000/64000 10000/10000000
> delay_access 2 allow Staff_networks
>
>
> Is this correct? If not what would be the correct configuration and if
> it is not too much trouble could a brief explanation be given please.
>

This is the method I would use to effect this policy (but you have some
errors). The alternative (once it becomes possible with code currently
in Squid2HEAD) would be to trust the Content_Length header returned by
the remote server (if such a header is even returned).

> I am familiar with delay pools configuration in general. I just don't
> completely understand what the number after the slash in
> delay_parameters represents.
> That is, in this line:
>
> delay_parameters 2 64000/64000 10000/10000000
> ^ ^
>
> What does the second 64000 and the last 10000000 represent?
>

With a class 2 delay pool, you have two buckets of chips that you can
redeem for a bit from the internet, an aggregate bucket and an
individual one. You have to redeem one chip from BOTH buckets to
receive an internet bit. Your buckets are refilled at a specific rate
(governed by the numbers in question) until it is full.

Currently you have specified an aggregate bucket of 512kbits, with a
refill rate of 512kbits/second. In other words, the aggregate bucket
starts off with 64000 chips in it, and refills at a rate of 64000 chips
per second. Everyone that is placed in this delay pool will be
contending for chips from this bucket (remember they need one of each
type).

Your individual bucket starts of with 10000 chips (80kbits) and has a
refill rate of 10000000 chips per second (about 1.2mbits/second). This
bucket will never empty, as the rate will be limited by the aggregate
bucket. To do what you want, you would be better off reversing these
two numbers. Start the bucket off with 10000000 chips, and refill it at
a rate of 10000 chips per second. While this will not give you the
"rate limit large files" exactly, that particular scheme could be
circumvented by downloading lots of little parts (each less than 10Meg)
of a large file.

acl Staff_networks src 10.0.0.0/255.0.0.0
delay_pools 1
delay_class 1 2
delay_parameters 1 64000/64000 10000000/10000
delay_access 1 allow Staff_networks

In your original example, you have specified delay_parameters and
delay_access for delay_pool 2, which is not defined. Being able to name
the pools would be a nice feature, as would giving the delay_classes
names instead of numbers...

Lastly, the individual bucket in a class 2 delay pool only keys off the
last octet in the client IP (in other words, 10.1.1.237 and
10.242.79.237 would share the same individual bucket). If you really
serve a /8 network (as your Staff_networks acl alludes), then a class 4
delay pool (from Squid 3) would be a better choice (with the
delay_parameters line set to...

delay_parameters 1 64000/64000 -1/-1 -1/-1 10000000/10000

...to put each authenticated user into a different individual bucket).

> I created this delay pool by following examples and could not find
> detailed explanations for these 2 parameters.
>
> Any help would be appreciated.
>

I hope the allegory is in some way useful, and I sincerely hope that I
have not confused you further.

> Thanks.
> Odin
>

Chris
Received on Wed Aug 13 2008 - 22:42:36 MDT

This archive was generated by hypermail 2.2.0 : Fri Aug 15 2008 - 12:00:03 MDT