Mailing List Archive

redirecting on overload
Hello,

I have a specific question about configuration of mod_bh.

On my site, I have a web server and a cluster of file servers. From
the web server I redirect requests for specific files to the file
servers. I'd like to setup the mod_bh of the servers to better
distribute the load of the file servers (now it is done as a dns
round-robin).

However, I'd like to have an option to redirect request to a different
site (Akamai) if all file servers are busy (or overloaded, according to
candidacy functions).

I think a special candidacy function would be needed. Am I right ?


--
Petr Prazak
GRISOFT
redirecting on overload [ In reply to ]
Petr Prazak wrote:

>I have a specific question about configuration of mod_bh.
>
>On my site, I have a web server and a cluster of file servers. From
>the web server I redirect requests for specific files to the file
>servers. I'd like to setup the mod_bh of the servers to better
>distribute the load of the file servers (now it is done as a dns
>round-robin).
>
>However, I'd like to have an option to redirect request to a different
>site (Akamai) if all file servers are busy (or overloaded, according to
>candidacy functions).
>
>I think a special candidacy function would be needed. Am I right ?
>
I'll prefix this by saying thatI haven't looked at the
HTTPRedirectByName code since I wrote it :-)

Well. I think I would write my own candidacy function to do exactly
what I wanted, but I bet you can get something working with the existing
functions. If you were running your own CDN, or used ont that didn't
manipulate the URL, you could use something like:

Backhand HTTPRedirectToName images.%1H

However, if you are using akamai, or some such beast, you need to munge
the URL. I would write it all in one candidacy funciont that changes
the request uri and sets the new hostname for redirect too. You can
steal it mostly from the HTTPRedirectByName code. You want the hostname
to simply be rewritten to something like: a160.g.akamaitech.net and the
request rewritten with the same sort of %S and %H stuff as the
HTTPRedirectToName supports. /images/pixel.gif would nee dto become
something like:

/3/160/31/9/%0H/images/pixel.gif

(which %0H would expand to the full Host: header of the request).

I am _sure_ that this can be done with backhand and mod_rewrite
together, but my rewrite kung fu is inferior.

You could solve this by aliasing /3/160/31/9/www.example.com/images/ to
/images/ on your server and then blanket rewrite every image that
arrives like that. Then you really only need to swap out the host and
not change the URI at all.

Enough ideas... I will stop rambling now.

--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
Phone: +1 301 776 6376 Fax: +1 410 880 4879
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7