Welcome! Log In Create A New Profile

Advanced

Re: Communications Sequence with Upstream

Magnus Lynch
April 26, 2010 06:40AM
On Sun, Apr 25, 2010 at 2:35 AM, agentzh <agentzh@gmail.com> wrote:
> On Sun, Apr 25, 2010 at 4:58 PM, Magnus Lynch <maglyx@gmail.com> wrote:
>> Say I have a location /url that I want to construct responses to based
>> on a sequence of communications with an upstream, host:port. To be
>> specific, the upstream would be a database, and the sequence of
>> communications would comprise commands and responses.
>
> We've been doing this kind of things via ngx_echo's echo_location
> directive in our ngx_memc and ngx_drizzle's tests suite. Here's some
> an example to do sequential memcached command execution against the
> ngx_memc upstream module in a single location /main:
>
>    location /main {
>        echo_location '/memc?cmd=flush_all';
>        echo_location '/memc?key=foo&cmd=set&val=';
>        echo_location '/memc?key=foo&cmd=get';
>    }
>    location /memc {
>        set $memc_cmd $arg_cmd;
>        set $memc_key $arg_key;
>        set $memc_value $arg_val;
>        memc_pass 127.0.0.1:11211;
>    }
>
> You can find more examples here:
> http://github.com/agentzh/memc-nginx-module/blob/master/test/t/

Thanks. I looked over echo_location. It uses ngx_http_subrequest,
which I had gathered to be limited to concatenating responses
together, and it still appears that way to me. It appears there's no
hook for you to deal with the data the subrequest produces, as the
various filter hooks the upstream support provides.

This the flow it appears to me you're limited to:
handler does HTTP GET x_1, response y_1 comes back, ..., HTTP GET x_n,
response y_n. and what message the handler ultimately produces is
y_1...y_n.

I'm interested in a more general ability to:
handler sends arbitrary message x_1, response y_1 comes back, ...
repeat n times. handler sends response f(y_1, ..., y_n) to original
query, f an arbitrary function--which is to say I want to have the
responses passed through a filter of mine as they're generated, not
sent straight to the client.

Maybe I'll have to write my own code from scratch for dealing with this.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Communications Sequence with Upstream

Magnus Lynch April 25, 2010 05:04AM

Re: Communications Sequence with Upstream

agentzh April 25, 2010 05:38AM

Re: Communications Sequence with Upstream

zhicheng April 25, 2010 06:29AM

Re: Communications Sequence with Upstream

agentzh April 25, 2010 06:46AM

Re: Communications Sequence with Upstream

agentzh April 25, 2010 06:48AM

Re: Communications Sequence with Upstream

zhicheng April 25, 2010 11:36AM

Re: Communications Sequence with Upstream

Magnus Lynch April 26, 2010 06:40AM

Re: Communications Sequence with Upstream

agentzh April 26, 2010 07:50AM

Re: Communications Sequence with Upstream

agentzh May 04, 2010 10:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 157
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready