You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Monajit Choudhury <mC...@sapient.com> on 2007/02/22 21:56:08 UTC

Proxy server using Mina

Hi
 I am new to MINA. I have a scenario where in I need to write a
tunneling proxy which listens to client requests does some processing on
the request and passes it on to the server. Now my question is, this
proxy needs to listen to 200 to 300 ports simultaneously. Right  now I
am testing it out using the Proxy code provided in the examples. I am
creating 200 to 300 clientHandlers(1 per port), 1 IoConnector and 1
IoAcceptor  to handle the requests.Is this the right approach or there
is a better way to do it. Please advise.

Regds
Monajit
 



Proxy server using Mina

Posted by Monajit Choudhury <mC...@sapient.com>.
 Hi 
 I was expecting a response :-). Think I put the question in a wrong
way. 
My current proxy implementation is based on the proxy example provided
with MINA. Its working fine as I am dealing with String requests and
responses only. I have integrated JMX successfully and it rocks. Now
moving along, I need to deal with serialized java objects as requests
and responses and my proxy is going to sit  in the middle , passing on
those objects to and fro.
Right now I am using the proxy to sit in between the sumup client and
server provided in the example code. Though the proxy is invoked, but I
am not able to pass on the java objects around. When I do a getObject(on
the ByteBuffer) on ClientToProxyIoHandler's sessionOpened() method I get
a BufferUnderflowException.I don't want to deserialize the objects (as
done in the sumup example) as this will add an amount of latency. I am
doing the deserialization ascyncrously using another framework.
Will really appreciate a response.

Regds
Monajit

-----Original Message-----
From: Monajit Choudhury [mailto:mChoudhury@sapient.com] 
Sent: Tuesday, February 27, 2007 5:00 PM
To: dev@mina.apache.org
Subject: RE: Proxy server using Mina

Hi
 Thanks for the response. Right now I am passing around String literals
only.But I want to pass around serialized java objects, and the proxy
should be able to trap it and store the objects, something like that. I
have seen the sumup application in the example pakg, which  passes
around java objects. But I am not able to do the same with the proxy
implementation.Is there a direct way of doing it without using the
bytebuffer?

Regds
Monajit


-----Original Message-----
From: Mark Webb [mailto:elihusmails@gmail.com]
Sent: Thu 2/22/2007 11:44 PM
To: dev@mina.apache.org
Subject: Re: Proxy server using Mina
 
so you are using the same acceptor to service the 200-300 ports?  I
would
think that this would work, since an acceptor would have to handle the
same
data if it were all coming in on the same port.  It certainly would not
hurt
to try and test your system with more than one acceptor though, just
keep in
mind that things would get more complex in your proxy when you add more
acceptors and connectors.

Let us know how things work out for you.


On 2/22/07, Monajit Choudhury <mC...@sapient.com> wrote:
>
>
> Hi
> I am new to MINA. I have a scenario where in I need to write a
> tunneling proxy which listens to client requests does some processing
on
> the request and passes it on to the server. Now my question is, this
> proxy needs to listen to 200 to 300 ports simultaneously. Right  now I
> am testing it out using the Proxy code provided in the examples. I am
> creating 200 to 300 clientHandlers(1 per port), 1 IoConnector and 1
> IoAcceptor  to handle the requests.Is this the right approach or there
> is a better way to do it. Please advise.
>
> Regds
> Monajit
>
>
>
>


-- 
..Cheers
Mark


RE: Proxy server using Mina

Posted by Monajit Choudhury <mC...@sapient.com>.
Hi
 Thanks for the response. Right now I am passing around String literals  only.But I want to pass around serialized java objects, and the proxy should be able to trap it and store the objects, something like that. I have seen the sumup application in the example pakg, which  passes around java objects. But I am not able to do the same with the proxy implementation.Is there a direct way of doing it without using the bytebuffer?

Regds
Monajit


-----Original Message-----
From: Mark Webb [mailto:elihusmails@gmail.com]
Sent: Thu 2/22/2007 11:44 PM
To: dev@mina.apache.org
Subject: Re: Proxy server using Mina
 
so you are using the same acceptor to service the 200-300 ports?  I would
think that this would work, since an acceptor would have to handle the same
data if it were all coming in on the same port.  It certainly would not hurt
to try and test your system with more than one acceptor though, just keep in
mind that things would get more complex in your proxy when you add more
acceptors and connectors.

Let us know how things work out for you.


On 2/22/07, Monajit Choudhury <mC...@sapient.com> wrote:
>
>
> Hi
> I am new to MINA. I have a scenario where in I need to write a
> tunneling proxy which listens to client requests does some processing on
> the request and passes it on to the server. Now my question is, this
> proxy needs to listen to 200 to 300 ports simultaneously. Right  now I
> am testing it out using the Proxy code provided in the examples. I am
> creating 200 to 300 clientHandlers(1 per port), 1 IoConnector and 1
> IoAcceptor  to handle the requests.Is this the right approach or there
> is a better way to do it. Please advise.
>
> Regds
> Monajit
>
>
>
>


-- 
..Cheers
Mark


Re: Proxy server using Mina

Posted by Mark Webb <el...@gmail.com>.
so you are using the same acceptor to service the 200-300 ports?  I would
think that this would work, since an acceptor would have to handle the same
data if it were all coming in on the same port.  It certainly would not hurt
to try and test your system with more than one acceptor though, just keep in
mind that things would get more complex in your proxy when you add more
acceptors and connectors.

Let us know how things work out for you.


On 2/22/07, Monajit Choudhury <mC...@sapient.com> wrote:
>
>
> Hi
> I am new to MINA. I have a scenario where in I need to write a
> tunneling proxy which listens to client requests does some processing on
> the request and passes it on to the server. Now my question is, this
> proxy needs to listen to 200 to 300 ports simultaneously. Right  now I
> am testing it out using the Proxy code provided in the examples. I am
> creating 200 to 300 clientHandlers(1 per port), 1 IoConnector and 1
> IoAcceptor  to handle the requests.Is this the right approach or there
> is a better way to do it. Please advise.
>
> Regds
> Monajit
>
>
>
>


-- 
..Cheers
Mark

Re: Proxy server using Mina

Posted by Niklas Therning <ni...@trillian.se>.
Monajit Choudhury wrote:
> Hi
>  I am new to MINA. I have a scenario where in I need to write a
> tunneling proxy which listens to client requests does some processing on
> the request and passes it on to the server. Now my question is, this
> proxy needs to listen to 200 to 300 ports simultaneously. Right  now I
> am testing it out using the Proxy code provided in the examples. I am
> creating 200 to 300 clientHandlers(1 per port), 1 IoConnector and 1
> IoAcceptor  to handle the requests.Is this the right approach or there
> is a better way to do it. Please advise.
>   

Sounds ok to me. If your clientHandlers are identical it should suffice
with a single instance for all the ports though.

-- 
Niklas Therning
www.spamdrain.net