Hello all, I am found Mongrel2 as I was searching pretty much for this functionality: http://mongrel2.org/static/mongrel2-manual.html#x1-680005.1.7 > 5.1.7 N:M Responses > In addition to this, you can setup Mongrel2 with the help of some 0MQ to send one request from > a browser to as many target handlers as you like. You can even send them messages > using OpenPGM for sending UDP messages reliably to clusters of computers. > >This means that Mongrel2 is the only web server capable of sending one request from a browser > to N backends at once, and then return the replies from these handlers to M browsers. > Not exactly sure what you could write with that, but it’s probably something really > damn cool. That's about what I would like. Any recipes on how to actually set such a thing up, though?
Hello, > I am found Mongrel2 as I was searching pretty much for this functionality: > > http://mongrel2.org/static/mongrel2-manual.html#x1-680005.1.7 > >> 5.1.7 N:M Responses >> In addition to this, you can setup Mongrel2 with the help of some 0MQ to send one request from >> a browser to as many target handlers as you like. You can even send them messages >> using OpenPGM for sending UDP messages reliably to clusters of computers. >> >> This means that Mongrel2 is the only web server capable of sending one request from a browser >> to N backends at once, and then return the replies from these handlers to M browsers. >> Not exactly sure what you could write with that, but it’s probably something really >> damn cool. > > That's about what I would like. Any recipes on how to actually set > such a thing up, though? Take a look at the 0MQ documentation. Mongrel2 publishes in round robin the requests to the handlers and subscribe to the answers from the handlers. But, nice thing, you can in your answer, address the message to several clients. So what you can do is you create a handler getting the request, dispatching it to N other handlers. Then each of these N handlers will answer back a response which can address M' clients, with Sum(M') = M. You have an extreme amount of flexibility, so "just a recipe" is not really feasible if you do not provide a clear scenario. Regards, loïc
Hi Loic Thanks for the response. Yes, I have indeed been looking into 0MQ for a while now, and the reason I came across Mongrel2 is because of that awareness. I've been thinking about how to distill it into a clearer scenario without burdening everyone here with details about what I have in mind. So I think I have distilled it down to this. Consider the fact that there are independent agents out there implementing different strategies for the same end goal (perhaps it's search). An end-user (the browser) does not really care which strategy is being used, it only cares about three things: 1. An ability to farm this out to as many different agents as it can 2. Only collecting results within a certain response threshold (timeout); a high-latency agent will be ignored. 3. Choosing one result out of many based on the agent's 'confidence' that it returns, assuming the confidence level is from 0 to 100%, so it's a simple choice. (In general after a while of course this 'confidence' returned by an agent would be normalized as to this agent's history). Ultimately what it is can be easily accomplished with something that speaks HTTP to the outside and internally has some libevent-like mechanism for talking to 'agents', and that's what I was looking to roll on my own pretty much before running across Mongrel2). -g On Wed, Sep 14, 2011 at 11:28 PM, Loic d'Anterroches <loic@ceondo.com> wrote: > Hello, > >> I am found Mongrel2 as I was searching pretty much for this functionality: >> >> http://mongrel2.org/static/mongrel2-manual.html#x1-680005.1.7 >> >>> 5.1.7 N:M Responses >>> In addition to this, you can setup Mongrel2 with the help of some 0MQ to send one request from >>> a browser to as many target handlers as you like. You can even send them messages >>> using OpenPGM for sending UDP messages reliably to clusters of computers. >>> >>> This means that Mongrel2 is the only web server capable of sending one request from a browser >>> to N backends at once, and then return the replies from these handlers to M browsers. >>> Not exactly sure what you could write with that, but it’s probably something really >>> damn cool. >> >> That's about what I would like. Any recipes on how to actually set >> such a thing up, though? > > Take a look at the 0MQ documentation. Mongrel2 publishes in round robin > the requests to the handlers and subscribe to the answers from the > handlers. But, nice thing, you can in your answer, address the message > to several clients. > > So what you can do is you create a handler getting the request, > dispatching it to N other handlers. Then each of these N handlers will > answer back a response which can address M' clients, with Sum(M') = M. > > You have an extreme amount of flexibility, so "just a recipe" is not > really feasible if you do not provide a clear scenario. > > Regards, > loïc >
Hello, > Consider the fact that there are independent agents out there > implementing different strategies for the same end goal (perhaps it's > search). An end-user (the browser) does not really care which strategy > is being used, it only cares about three things: > > 1. An ability to farm this out to as many different agents as it can > 2. Only collecting results within a certain response threshold > (timeout); a high-latency agent will be ignored. > 3. Choosing one result out of many based on the agent's 'confidence' > that it returns, assuming the confidence level is from 0 to 100%, so > it's a simple choice. (In general after a while of course this > 'confidence' returned by an agent would be normalized as to this > agent's history). > > Ultimately what it is can be easily accomplished with something that > speaks HTTP to the outside and internally has some libevent-like > mechanism for talking to 'agents', and that's what I was looking to > roll on my own pretty much before running across Mongrel2). Setup a queue without a queue. That is, when your handler get a request for a "job" by a client, farm the work to N workers + 1 ticket master and directly from the handler answer a template page with chunked encoding. Basically, with everything but the last </body></html>. Then each worker at the end of the work will control with the ticket master if they can send directly to the client their piece of work. If yes, send a chunk. If not, discard or "cache" it and let the ticket master send a termination chunk. The work chunk would be wrapped in a small piece of JS to replace the corresponding part of the template. This means instantaneous answer to the client and the page is filled rapidly within the timeout you control by the ticket master. Basically you queue the work without even the need of a queue, everything is going over a single TCP connection (no ajax whatever polling) and is compatible with all the browsers out there. This is my "zero queue queue system" faster and better than all the others. This is thanks to the ability for Mongrel2 to address a given answer to a given client... really nice design decision... loïc > On Wed, Sep 14, 2011 at 11:28 PM, Loic d'Anterroches <loic@ceondo.com> wrote: >> Hello, >> >>> I am found Mongrel2 as I was searching pretty much for this functionality: >>> >>> http://mongrel2.org/static/mongrel2-manual.html#x1-680005.1.7 >>> >>>> 5.1.7 N:M Responses >>>> In addition to this, you can setup Mongrel2 with the help of some 0MQ to send one request from >>>> a browser to as many target handlers as you like. You can even send them messages >>>> using OpenPGM for sending UDP messages reliably to clusters of computers. >>>> >>>> This means that Mongrel2 is the only web server capable of sending one request from a browser >>>> to N backends at once, and then return the replies from these handlers to M browsers. >>>> Not exactly sure what you could write with that, but it’s probably something really >>>> damn cool. >>> >>> That's about what I would like. Any recipes on how to actually set >>> such a thing up, though? >> >> Take a look at the 0MQ documentation. Mongrel2 publishes in round robin >> the requests to the handlers and subscribe to the answers from the >> handlers. But, nice thing, you can in your answer, address the message >> to several clients. >> >> So what you can do is you create a handler getting the request, >> dispatching it to N other handlers. Then each of these N handlers will >> answer back a response which can address M' clients, with Sum(M') = M. >> >> You have an extreme amount of flexibility, so "just a recipe" is not >> really feasible if you do not provide a clear scenario. >> >> Regards, >> loïc >>