You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by deepak srinivasan <sd...@gmail.com> on 2012/11/22 12:06:23 UTC

Multiple origin servers

 Hello,
We are working on a project which uses ATS as the main component of the
design.
We wanted to do a setup like LOAD BALANCERS --> POOL OF ATS SERVERS -->
POOL OF ORIGINS SERVER.
>From some discussion on the mailing list we came to know that this is not
possible.
Would request if some one can put a light on this and guide me if its
possible or not.
would like to know if remap.config or any other config file will help me
achieve ATS to forward 1 single HTTP request to multiple Origin servers.
We  are using ATS v 3.2

thanks and regards
deepak

RE: Multiple origin servers

Posted by Luca Rea <lu...@contactlab.com>.
Hi,
I think that's possible using lua remap plugin:

1. you send request to ATS for the url http://example.com
2. in remap.config you put something like:
regex_map http://origin1.(.*) http://$1
regex_map http://origin2.(.*) http://$1
3. in lua remap plugin you can send an external request for http://origin1.example.com and another one for http://origin2.example.com (using a pool and passing through the proxy itself), finally keep plugin return with the original url (http://example.com)
4. the first request of the pool is cached, the second one get the value by the first request returned and ATS return the original url getting it from the cache too.


I suppose that "should" work



Re: Multiple origin servers

Posted by Leif Hedstrom <zw...@apache.org>.
On 11/29/12 7:26 AM, deepak srinivasan wrote:
> Hello,
> Thank-you for the useful response. we tried the options but the conclusion 
> is ATS forwards the request to the PoOS in round robin, we are having a 
> requirement that ATS should forward the HTTP request to multiple server at 
> one go. i.e 1 HTTP request sent multiple Servers through ATS at same time. 
> We are thinking to do this with a help of a external network libraries 
> used for generation of HTTP request with in a Plugin. We are using remap 
> configuration.
> Wanted to know is this is a possible scenario? Also would like to know in 
> this scenario will ATS server provide us the feature of Caching the data?


What exactly is the expected outcome? You want it to fire off multiple 
requests to several backends, and return the first response to the client 
and drop all others? Is ATS expected to merge the responses from all origin 
requests, and send the merged results back to the client?

IN either case, it sounds like what you want it something similar to the 
SPDY protocol / plugin. I saw a reply suggesting the Lua plugin, but not 
sure it can do this (james, can the Lua plugin create HttpConnect VC's ?). 
But then again, I don't understand exactly what you are trying to accomplish.

In all cases, you can't use a network API layer that doesn't hook into the 
NetVC / event processing system of ATS. I.e. you can't have a request block 
on an external network API call. This is just how ATS is designed, with 
asynchronous event processing in a small number of threads.

I hope that helps.

-- leif


Re: Multiple origin servers

Posted by deepak srinivasan <sd...@gmail.com>.
Hello,
Thank-you for the useful response. we tried the options but the conclusion
is ATS forwards the request to the PoOS in round robin, we are having a
requirement that ATS should forward the HTTP request to multiple server at
one go. i.e 1 HTTP request sent multiple Servers through ATS at same time.
We are thinking to do this with a help of a external network libraries used
for generation of HTTP request with in a Plugin. We are using remap
configuration.
 Wanted to know is this is a possible scenario? Also would like to know in
this scenario will ATS server provide us the feature of Caching the data?

thanks and regards




On Tue, Nov 27, 2012 at 9:32 PM, Leif Hedstrom <zw...@apache.org> wrote:

> On 11/26/12 10:15 PM, James Peach wrote:
>
>>
>>
>> Implementing this however would probably require us to touch on
>> everything in core, something that (w|c)ould destabilize ATS…
>> We already do balancing when an origin has multiple DNS entries, so we
>> should expose a way for plugins to populate the set of names or addresses
>> for a single origin. I agree that health checking is probably also best
>> left to plugins; you can do a reasonable job using TSFetchURL. The other
>> task that ought to be extensible with a plugin is mapping a request to a
>> specific origin address, which should be pretty straightforward to do in a
>> remap plugin.
>>
>
> +1. Lets all brainstorm / hack at ApacheCon NA'13  :). Part of this, I
> really believe HostDB and the way that stuff works, has to be refactored /
> replaced. That should be the key to getting the core ready for a more
> modularized host resolution / load balancing.
>
>
>
>
>> I think that we have almost all the pieces to generalize this, but
>> there's a fair bit of effort involved in bringing them all together and
>> "productizing them".
>>
>> ... and I'd be happy to merge anybody's Lua patches :)
>>
>>
>
> I need to start using this sucker... What's state is it in now? is it
> usable ? I'm thinking, as a "prototype", to convert my remap.config and all
> the plugins I'm using into one Lua script. Heck, maybe I can even create a
> "converter" :).
>
> -- Leif
>



-- 
regards
deepak
Graduate (Fresher)
Electronics Design and Manufacturing
IIIT (D&M),Kancheepuram
IIT Madras Campus,Chennai

Re: Multiple origin servers

Posted by Leif Hedstrom <zw...@apache.org>.
On 11/26/12 10:15 PM, James Peach wrote:
>
>
> Implementing this however would probably require us to touch on
> everything in core, something that (w|c)ould destabilize ATS…
> We already do balancing when an origin has multiple DNS entries, so we should expose a way for plugins to populate the set of names or addresses for a single origin. I agree that health checking is probably also best left to plugins; you can do a reasonable job using TSFetchURL. The other task that ought to be extensible with a plugin is mapping a request to a specific origin address, which should be pretty straightforward to do in a remap plugin.

+1. Lets all brainstorm / hack at ApacheCon NA'13  :). Part of this, I 
really believe HostDB and the way that stuff works, has to be refactored 
/ replaced. That should be the key to getting the core ready for a more 
modularized host resolution / load balancing.


>
> I think that we have almost all the pieces to generalize this, but there's a fair bit of effort involved in bringing them all together and "productizing them".
>
> ... and I'd be happy to merge anybody's Lua patches :)
>


I need to start using this sucker... What's state is it in now? is it 
usable ? I'm thinking, as a "prototype", to convert my remap.config and 
all the plugins I'm using into one Lua script. Heck, maybe I can even 
create a "converter" :).

-- Leif

Re: Multiple origin servers

Posted by James Peach <jp...@apache.org>.
On 26/11/2012, at 12:57 AM, Igor Galić <i....@brainsware.org> wrote:

>>> So my question is about the balancer plugin - why exactly is it
>>> broken?
>> 
>> It has a bunch of dependencies on Yahoo infrastructure that were
>> never open sourced.
>> 
>>> Does the planned rewrite by Alan have an ETA?
>> 
>> The plugin works by making an IPC call to a balancing service. We
>> would need to evaluate and choose a suitable service, then implement
>> the balancer IPC calls or implement a full balancer. I guess that
>> what I'm saying is that there's not actually much load balancing
>> code in the balancer plugin ;)
> 
> There have been vocal calls from the developer community to
> place the loadbalancing capabilities into the core, while laying
> the responsibility of checking of checking the backend's health
> into the virtual hands of plugins, or the real hands of their
> developers. (This is probably something that could easily be
> done in Lua, even by "mere" admins)
> 
> Implementing this however would probably require us to touch on
> everything in core, something that (w|c)ould destabilize ATS…

We already do balancing when an origin has multiple DNS entries, so we should expose a way for plugins to populate the set of names or addresses for a single origin. I agree that health checking is probably also best left to plugins; you can do a reasonable job using TSFetchURL. The other task that ought to be extensible with a plugin is mapping a request to a specific origin address, which should be pretty straightforward to do in a remap plugin.

I think that we have almost all the pieces to generalize this, but there's a fair bit of effort involved in bringing them all together and "productizing them".

... and I'd be happy to merge anybody's Lua patches :)

J

Re: Multiple origin servers

Posted by Igor Galić <i....@brainsware.org>.
> > So my question is about the balancer plugin - why exactly is it
> > broken?
> 
> It has a bunch of dependencies on Yahoo infrastructure that were
> never open sourced.
> 
> > Does the planned rewrite by Alan have an ETA?
> 
> The plugin works by making an IPC call to a balancing service. We
> would need to evaluate and choose a suitable service, then implement
> the balancer IPC calls or implement a full balancer. I guess that
> what I'm saying is that there's not actually much load balancing
> code in the balancer plugin ;)

There have been vocal calls from the developer community to
place the loadbalancing capabilities into the core, while laying
the responsibility of checking of checking the backend's health
into the virtual hands of plugins, or the real hands of their
developers. (This is probably something that could easily be
done in Lua, even by "mere" admins)

Implementing this however would probably require us to touch on
everything in core, something that (w|c)ould destabilize ATS…

i

-- 
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE


Re: Multiple origin servers

Posted by James Peach <jp...@apache.org>.
On 25/11/2012, at 3:13 PM, Tomasz Kuzemko <to...@kuzemko.net> wrote:

> Hello,
> I'm working on a project with a similar setup and would like to use ATS as a reverse proxy with caching.
> 
> My "PoOS" hosts thousands of domains, so I configured ATS as an open relay and made a plugin to authorize requests based on a whitelist of backend IP addresses.
> 
> For now I used option 2) for a simple round robin LB on PoOS, but in the future I may need a more sophisticated solution, for example with stickiness.
> 
> So my question is about the balancer plugin - why exactly is it broken?

It has a bunch of dependencies on Yahoo infrastructure that were never open sourced.

> Does the planned rewrite by Alan have an ETA?

The plugin works by making an IPC call to a balancing service. We would need to evaluate and choose a suitable service, then implement the balancer IPC calls or implement a full balancer. I guess that what I'm saying is that there's not actually much load balancing code in the balancer plugin ;)

> 
> --
> Tomasz Kuzemko
> tomasz@kuzemko.net
> 
> W dniu 22.11.2012 17:36, Leif Hedstrom pisze:
>> On 11/22/12 6:06 AM, deepak srinivasan wrote:
>>> Hello,
>>> We are working on a project which uses ATS as the main component of
>>> the design.
>>> We wanted to do a setup like LOAD BALANCERS --> POOL OF ATS SERVERS
>>> --> POOL OF ORIGINS SERVER.
>>> From some discussion on the mailing list we came to know that this is
>>> not possible.
>>> Would request if some one can put a light on this and guide me if its
>>> possible or not.
>>> would like to know if remap.config or any other config file will help
>>> me achieve ATS to forward 1 single HTTP request to multiple Origin
>>> servers.
>>> We  are using ATS v 3.2
>>> 
>> 
>> You have a few options:
>> 
>> 1) Create a DNS entry for the "Pool of Origin Servers" (PoOS from now on
>> ;), with multiple A-records. ATS will round-robin across those IPs, and
>> detect connect failures etc.
>> 
>> 2) Use the Parent Proxy config (parent.config), and add your PoOS
>> machines there.
>> 
>> 3) Write a simple plugin that does something intelligent when setting
>> the destination address of the PoOS. This is how the (broken!) balancer
>> plugin works, it's just not fully open sourced.
>> 
>> -- Leif
>> 
>> 
>> P.s
>> 3) needs some serious loving, not only from the plugin perspective, but
>> from the fact that we don't integrate nicely with our DNS cache, health
>> checks, or how to handle failures (such as allowing it to try a
>> different machine upon failures, calling the plugin again). Alan M.
>> Carroll has promised he will rewrite all this, and we all get ponies
>> too. Thanks Alan!
>> 
>> P.p.s
>> That was a wee bit of Thanksgiving fun at the end. We get no ponies :/.
>> 


Re: Multiple origin servers

Posted by Tomasz Kuzemko <to...@kuzemko.net>.
Hello,
I'm working on a project with a similar setup and would like to use ATS 
as a reverse proxy with caching.

My "PoOS" hosts thousands of domains, so I configured ATS as an open 
relay and made a plugin to authorize requests based on a whitelist of 
backend IP addresses.

For now I used option 2) for a simple round robin LB on PoOS, but in the 
future I may need a more sophisticated solution, for example with 
stickiness.

So my question is about the balancer plugin - why exactly is it broken? 
Does the planned rewrite by Alan have an ETA?

--
Tomasz Kuzemko
tomasz@kuzemko.net

W dniu 22.11.2012 17:36, Leif Hedstrom pisze:
> On 11/22/12 6:06 AM, deepak srinivasan wrote:
>>  Hello,
>> We are working on a project which uses ATS as the main component of
>> the design.
>> We wanted to do a setup like LOAD BALANCERS --> POOL OF ATS SERVERS
>> --> POOL OF ORIGINS SERVER.
>> From some discussion on the mailing list we came to know that this is
>> not possible.
>> Would request if some one can put a light on this and guide me if its
>> possible or not.
>> would like to know if remap.config or any other config file will help
>> me achieve ATS to forward 1 single HTTP request to multiple Origin
>> servers.
>> We  are using ATS v 3.2
>>
>
> You have a few options:
>
> 1) Create a DNS entry for the "Pool of Origin Servers" (PoOS from now on
> ;), with multiple A-records. ATS will round-robin across those IPs, and
> detect connect failures etc.
>
> 2) Use the Parent Proxy config (parent.config), and add your PoOS
> machines there.
>
> 3) Write a simple plugin that does something intelligent when setting
> the destination address of the PoOS. This is how the (broken!) balancer
> plugin works, it's just not fully open sourced.
>
> -- Leif
>
>
> P.s
> 3) needs some serious loving, not only from the plugin perspective, but
> from the fact that we don't integrate nicely with our DNS cache, health
> checks, or how to handle failures (such as allowing it to try a
> different machine upon failures, calling the plugin again). Alan M.
> Carroll has promised he will rewrite all this, and we all get ponies
> too. Thanks Alan!
>
> P.p.s
> That was a wee bit of Thanksgiving fun at the end. We get no ponies :/.
>

Re: Multiple origin servers

Posted by Jan-Frode Myklebust <ja...@tanso.net>.

Den 22. nov. 2012 kl. 17:36 skrev Leif Hedstrom <zw...@apache.org>:
> 
> 1) Create a DNS entry for the "Pool of Origin Servers" (PoOS from now on ;), with multiple A-records. ATS will round-robin across those IPs, and detect connect failures etc.
> 

What's the behaviour on connection failures here? Will ATS retry the failed request on the next origin server, without returning any failure to the client?



  -jf

Re: Multiple origin servers

Posted by Leif Hedstrom <zw...@apache.org>.
On 11/22/12 6:06 AM, deepak srinivasan wrote:
>  Hello,
> We are working on a project which uses ATS as the main component of 
> the design.
> We wanted to do a setup like LOAD BALANCERS --> POOL OF ATS SERVERS 
> --> POOL OF ORIGINS SERVER.
> From some discussion on the mailing list we came to know that this is 
> not possible.
> Would request if some one can put a light on this and guide me if its 
> possible or not.
> would like to know if remap.config or any other config file will help 
> me achieve ATS to forward 1 single HTTP request to multiple Origin 
> servers.
> We  are using ATS v 3.2
>

You have a few options:

1) Create a DNS entry for the "Pool of Origin Servers" (PoOS from now on 
;), with multiple A-records. ATS will round-robin across those IPs, and 
detect connect failures etc.

2) Use the Parent Proxy config (parent.config), and add your PoOS 
machines there.

3) Write a simple plugin that does something intelligent when setting 
the destination address of the PoOS. This is how the (broken!) balancer 
plugin works, it's just not fully open sourced.

-- Leif


P.s
3) needs some serious loving, not only from the plugin perspective, but 
from the fact that we don't integrate nicely with our DNS cache, health 
checks, or how to handle failures (such as allowing it to try a 
different machine upon failures, calling the plugin again). Alan M. 
Carroll has promised he will rewrite all this, and we all get ponies 
too. Thanks Alan!

P.p.s
That was a wee bit of Thanksgiving fun at the end. We get no ponies :/.