[squid-users] Speed ​​limit from file size

Michael Pro michael.adm at gmail.com
Thu Jun 21 11:11:34 UTC 2018


Simplify the task, let's say that I need to limit the speed only for
what is in the cache, for each client. Example
-----
client_side_reply.cc(2191) sendMoreData: local=127.0.0.1:20880
remote=10.0.0.18:32611 FD 99 flags=1
'http://app-2.squid.internal/file.exe' out.offset=3681475
-----
for this type of traffic is it possible made this logic ?
file =<1MB client download with 400Kbit/s
file 1MB...5MB client donload with 4Mbit/s
file >5MB - no speed limit


чт, 21 июн. 2018 г. в 8:18, Alex Rousskov <rousskov at measurement-factory.com>:
>
> On 06/20/2018 01:44 PM, Michael Pro wrote:
> > Is it possible to limit the speed of receiving the file to the client
> > depending on the file size?
>
> > Let's say,
> > file =<1MB client download with 400Kbit/s
> > file 1MB...5MB client donload with 4Mbit/s
> > file >5MB - no speed limit
>
>
> For HTTP responses with a Content-Length header, you can create poor
> man's equivalent of a missing response_body_size ACL. For example:
>
>   acl smallerThanTenBytes rep_header Content-Length ^[0-9]$
>
> With an ACL like that, you can direct responses to the right pool. IIRC,
> pool assignment may happen multiple times during the lifetime of a
> transaction so you need to be careful to deal with assignments that are
> done before there is a response. Delay pools are not my area of
> expertise but others on the list can help you with the details.
>
>
> For HTTP responses without a Content-Length header, you can use an
> adaptation service (ICAP or eCAP) to tag transactions that start to
> exceed 1MB and 5MB boundaries. A "note" ACL can check for that tag, but
> I do not think Squid delay pools re-check pool ACLs after the response
> body bytes start to flow. If I am right, then you would not be able to
> (re)route response body bytes to the right delay pool for responses
> without a Content-Length header.
>
> You could use an adaptation service itself to slow responses without
> Content-Length down (partially duplicating Squid's delay pools
> capabilities), but the precision of such an approach may be too low due
> to Squid internal buffering. YMMV.
>
>
> For HTTP CONNECT tunnels (i.e., HTTPS traffic) even the adaptation
> tricks would not work because adaptation services do not get CONNECT
> tunnel bytes (yet?). You would have to bump the tunnel to get access to
> the HTTP responses inside (and bumping opens another huge Pandora box).
>
>
> HTH,
>
> Alex.


More information about the squid-users mailing list