You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Mark Webb <el...@gmail.com> on 2007/01/12 16:15:11 UTC

mina proxy question

I was wondering if it is possible to write a proxy that accepts multiple,
concurrent connections on one side and pushes the data out the other side in
serial?  The data coming back would be serial and pushed out concurrently.
The biggest problem I am running in to is that the responses that I am
sending to the backend will not come back in the same order in which I sent
them.

Here is a rough idea.

Concurrent -> MINA Proxy --> serial --> backend request
Concurrent <- MINA Proxy <- serial <-- backend response

Is something like this possible?

-- 
..Cheers
Mark

Re: mina proxy question

Posted by Mark Webb <el...@gmail.com>.
Thanks for the information.  I will give your idea a shot.



On 1/14/07, Trustin Lee <tr...@gmail.com> wrote:
>
> Hi Mark,
>
> On 1/13/07, Mark Webb <el...@gmail.com> wrote:
> >
> > yes.  Think of it as a multi-threaded web server going to a single
> > threaded
> > database, where the database query could have an identifier that is
> placed
> > into the query results.  The problem is that Http request #2 might make
> a
> > database query in 1 second, where Http request #1 would make a query
> that
> > takes 10 seconds.  I need a way to correlate the data inside of MINA,
> and
> > I
> > almost think that MINA does this already.
>
>
> To be short, it is possible.  You can create one acceptor and one
> connector.  The acceptor could accept multiple connections, and its all
> IoHandlers could have a reference to IoSession or IoConnector to access
> the
> connection to the database query processor.  When the database query
> processor receives a response message, you could correlate it with an
> appropriate IoSession (the acceptor side one) with some data structure
> such
> as Map.  It shouldn't be that hard though.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP key fingerprints:
> * E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
> * B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6
>
>


-- 
..Cheers
Mark

Re: mina proxy question

Posted by Trustin Lee <tr...@gmail.com>.
Hi Mark,

On 1/13/07, Mark Webb <el...@gmail.com> wrote:
>
> yes.  Think of it as a multi-threaded web server going to a single
> threaded
> database, where the database query could have an identifier that is placed
> into the query results.  The problem is that Http request #2 might make a
> database query in 1 second, where Http request #1 would make a query that
> takes 10 seconds.  I need a way to correlate the data inside of MINA, and
> I
> almost think that MINA does this already.


To be short, it is possible.  You can create one acceptor and one
connector.  The acceptor could accept multiple connections, and its all
IoHandlers could have a reference to IoSession or IoConnector to access the
connection to the database query processor.  When the database query
processor receives a response message, you could correlate it with an
appropriate IoSession (the acceptor side one) with some data structure such
as Map.  It shouldn't be that hard though.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: mina proxy question

Posted by Mark Webb <el...@gmail.com>.
yes.  Think of it as a multi-threaded web server going to a single threaded
database, where the database query could have an identifier that is placed
into the query results.  The problem is that Http request #2 might make a
database query in 1 second, where Http request #1 would make a query that
takes 10 seconds.  I need a way to correlate the data inside of MINA, and I
almost think that MINA does this already.

Thank you.


On 1/12/07, Maarten Bosteels <mb...@gmail.com> wrote:
>
> Is there some data in the response that you can use to identify
> the corresponding request ?
>
> Maarten
>
> On 1/12/07, Mark Webb <el...@gmail.com> wrote:
> > I was wondering if it is possible to write a proxy that accepts
> multiple,
> > concurrent connections on one side and pushes the data out the other
> side in
> > serial?  The data coming back would be serial and pushed out
> concurrently.
> > The biggest problem I am running in to is that the responses that I am
> > sending to the backend will not come back in the same order in which I
> sent
> > them.
> >
> > Here is a rough idea.
> >
> > Concurrent -> MINA Proxy --> serial --> backend request
> > Concurrent <- MINA Proxy <- serial <-- backend response
> >
> > Is something like this possible?
> >
> > --
> > ..Cheers
> > Mark
> >
> >
>



-- 
..Cheers
Mark

Re: mina proxy question

Posted by Maarten Bosteels <mb...@gmail.com>.
Is there some data in the response that you can use to identify
the corresponding request ?

Maarten

On 1/12/07, Mark Webb <el...@gmail.com> wrote:
> I was wondering if it is possible to write a proxy that accepts multiple,
> concurrent connections on one side and pushes the data out the other side in
> serial?  The data coming back would be serial and pushed out concurrently.
> The biggest problem I am running in to is that the responses that I am
> sending to the backend will not come back in the same order in which I sent
> them.
>
> Here is a rough idea.
>
> Concurrent -> MINA Proxy --> serial --> backend request
> Concurrent <- MINA Proxy <- serial <-- backend response
>
> Is something like this possible?
>
> --
> ..Cheers
> Mark
>
>