Re: [squid-users] Inelegant routing based on file size

From: Regardt van de Vyver <squid_at_intergate.co.za>
Date: Mon, 20 Oct 2008 09:43:29 +0200

Vernon Kennedy-Van Dam wrote:
> Thanx very much Amos. Much appreciated with the feedback.
>
>
>
>> Hi All
>>
>> I am looking to route download traffic based on file size of the download
>> requests. If a user in our network was to download a 10mb file, he gets
>> routed through link 1. If a user requests a 100mb file download, he gets
>> routed through link 2.
>>
>> How is this achieved?
>>
>
> It can not. File size is not known until after the file starts arriving.
> Sometimes not even until it has finished arriving.
>
> The best you may possibly do is create a custom external ACL helper to
> scan store.log for previous file sizes of requested URL. Then use
> tcp_outgoing_address based on a best-guess.
>
> This however breaks completely on:
> * new and unknown URL,
> * changed URLs,
> * dynamic URL (very common!),
> * and most websites updated by their webmaster between your visits
> (almost as common as dynamic URLs).
>
> Amos
>
>
Well, we used a rather complicated way to achive something similar - so
it seems possible.

Use url_rewrite_program to redirect the request to an inspection script.

The inspection script then fetches the HTTP headers of the file to
determine file size. If small enough or not indicated, the script
returns the url untouched so that the local cache processes it.

If the file is larger, you can redirect to an alternate url/script that
can do the fetching. The only thing I've not tested, is possibly making
the redirect send to another proxy server, not entirely sure of that syntax.

But you get the general idea.
Received on Mon Oct 20 2008 - 07:43:48 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 20 2008 - 12:00:04 MDT