You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Dhruv Chopra <dh...@shephertz.com> on 2013/11/28 04:50:24 UTC

MINA on multihomed machine

Hi,

I wanted to know if MINA supports binding to multiple IP interfaces? So if
my machine has 2 IP addresses (A and B) - can I make a single MINA process
bind to both? It seems to me it should be possible by just creating a
second NioSocketAcceptor object, binding it to the second local IP address
and setting the handler as usual. Just wanted to know if there are any
gotchas and if someone has tried this before.

Thanks,
Dhruv

Re: MINA on multihomed machine

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 11/28/13 4:50 AM, Dhruv Chopra a écrit :
> Hi,
>
> I wanted to know if MINA supports binding to multiple IP interfaces? So if
> my machine has 2 IP addresses (A and B) - can I make a single MINA process
> bind to both? It seems to me it should be possible by just creating a
> second NioSocketAcceptor object, binding it to the second local IP address
> and setting the handler as usual. Just wanted to know if there are any
> gotchas and if someone has tried this before.

>From the top of my head, yu can bind on more than one IP address.


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: MINA on multihomed machine

Posted by Bernd Fondermann <be...@gmail.com>.
On Thu, Nov 28, 2013 at 3:53 PM, Dhruv Chopra <dh...@shephertz.com>wrote:

> Thanks! that clarifies things.. I guess I would run in to this 64k limit
> only when in my tests I run the clients and the MINA server on the same
> machine.
>

Not neccessarily. You could set up more than one loopback device (often at
IP 127.0.0.1).
See http://en.wikipedia.org/wiki/Localhost

  Bernd

Re: MINA on multihomed machine

Posted by Dhruv Chopra <dh...@shephertz.com>.
I see - yes that can happen with mobile providers or with ISPs who do
NAT444.
Didn't understand this part in your reply
"So a small port range may be a good idea if you are planning to have a
huge amout of connections."
Are you referring to the local ephemeral port range on the server machine?


On Thu, Nov 28, 2013 at 8:53 PM, Steve Ulrich <st...@proemion.com>wrote:

> > dhruv.chopra@shephertz.co.in wrote
> >
> > Thanks! that clarifies things.. I guess I would run in to this 64k
> > limit only when in my tests I run the clients and the MINA server on
> > the same machine.
>
> There may be a catch if your clients are mobiles or within another NAT-ed
> network. Most mobile providers hide their users behind NAT-gateways, so the
> connecting "client IP" is the gateway of the provider. Depending on the
> logic and number of routers/router IPs, it may be a problem or not.
> We had some problems with mobile providers at argentinia, where the
> oversimplified logic (port= ++lastport) of the gateway caused some trouble
> with a few hundreds of devices. That was some years ago and they managed to
> solve it after some time.
> So a small port range may be a good idea if you are planning to have a
> huge amout of connections.
>
> regards
>
> Steve
>
>
>

RE: MINA on multihomed machine

Posted by Steve Ulrich <st...@proemion.com>.
> dhruv.chopra@shephertz.co.in wrote
>
> Thanks! that clarifies things.. I guess I would run in to this 64k
> limit only when in my tests I run the clients and the MINA server on
> the same machine.

There may be a catch if your clients are mobiles or within another NAT-ed network. Most mobile providers hide their users behind NAT-gateways, so the connecting "client IP" is the gateway of the provider. Depending on the logic and number of routers/router IPs, it may be a problem or not.
We had some problems with mobile providers at argentinia, where the oversimplified logic (port= ++lastport) of the gateway caused some trouble with a few hundreds of devices. That was some years ago and they managed to solve it after some time.
So a small port range may be a good idea if you are planning to have a huge amout of connections.

regards

Steve



Re: MINA on multihomed machine

Posted by Dhruv Chopra <dh...@shephertz.com>.
Thanks! that clarifies things.. I guess I would run in to this 64k limit
only when in my tests I run the clients and the MINA server on the same
machine.


On Thu, Nov 28, 2013 at 8:08 PM, Steve Ulrich <st...@proemion.com>wrote:

> > Emmanuel Lécharny [mailto:elecharny@gmail.com] wrote
> >
> > Le 11/28/13 2:51 PM, Dhruv Chopra a écrit :
> > > I understand how it will work with acceptors and binding to different
> > > interface - I would like to know if someone has done it with MINA
> > > before and could share their experience. To handle more than 65k+
> > > concurrent tcp clients (16 bit port range) - I will need such a
> > setup.
> >
> > No. you are limited to 65 000 ports for a specific cumple <client IP,
> > server IP>, not to 65 000 connections. Your server can handle way more
> > than 65 000 connections on one single address and one single port.
>
> More specifically, you are limited to 65K connections for <client IP,
> Server IP, Server Port>. So you could open up to 65K x 65K ~ 4G Connections
> from one Client IP to a single Server IP. Binding multiple ports is easy
> and can be done with a single Acceptor.
> It shouldn't be a problem, but I haven't tried multiple IPs, yet. Just
> bind() on it.
>
> > Check
> > http://stackoverflow.com/questions/2332741/what-is-the-theoretical-
> > maximum-number-of-open-tcp-connections-that-a-modern-lin
>
>
>
>
>

RE: MINA on multihomed machine

Posted by Steve Ulrich <st...@proemion.com>.
> Emmanuel Lécharny [mailto:elecharny@gmail.com] wrote
>
> Le 11/28/13 2:51 PM, Dhruv Chopra a écrit :
> > I understand how it will work with acceptors and binding to different
> > interface - I would like to know if someone has done it with MINA
> > before and could share their experience. To handle more than 65k+
> > concurrent tcp clients (16 bit port range) - I will need such a
> setup.
>
> No. you are limited to 65 000 ports for a specific cumple <client IP,
> server IP>, not to 65 000 connections. Your server can handle way more
> than 65 000 connections on one single address and one single port.

More specifically, you are limited to 65K connections for <client IP, Server IP, Server Port>. So you could open up to 65K x 65K ~ 4G Connections from one Client IP to a single Server IP. Binding multiple ports is easy and can be done with a single Acceptor.
It shouldn't be a problem, but I haven't tried multiple IPs, yet. Just bind() on it.

> Check
> http://stackoverflow.com/questions/2332741/what-is-the-theoretical-
> maximum-number-of-open-tcp-connections-that-a-modern-lin





Re: MINA on multihomed machine

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 11/28/13 2:51 PM, Dhruv Chopra a écrit :
> I understand how it will work with acceptors and binding to different
> interface - I would like to know if someone has done it with MINA before
> and could share their experience. To handle more than 65k+ concurrent tcp
> clients (16 bit port range) - I will need such a setup.

No. you are limited to 65 000 ports for a specific cumple <client IP,
server IP>, not to 65 000 connections. Your server can handle way more
than 65 000 connections on one single address and one single port.

Check
http://stackoverflow.com/questions/2332741/what-is-the-theoretical-maximum-number-of-open-tcp-connections-that-a-modern-lin


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com 


Re: MINA on multihomed machine

Posted by Dhruv Chopra <dh...@shephertz.com>.
I understand how it will work with acceptors and binding to different
interface - I would like to know if someone has done it with MINA before
and could share their experience. To handle more than 65k+ concurrent tcp
clients (16 bit port range) - I will need such a setup. If there are any
bench marks for this that would be great.


On Thu, Nov 28, 2013 at 1:44 PM, Jeff MAURY <je...@gmail.com> wrote:

> That's more a java/socket problem.
>
> You should use 0.0.0.0 as the binding address
>
> Jeff
>
> —
> Sent from Mailbox for iPhone
>
> On Thu, Nov 28, 2013 at 4:50 AM, Dhruv Chopra <dh...@shephertz.com>
> wrote:
>
> > Hi,
> > I wanted to know if MINA supports binding to multiple IP interfaces? So
> if
> > my machine has 2 IP addresses (A and B) - can I make a single MINA
> process
> > bind to both? It seems to me it should be possible by just creating a
> > second NioSocketAcceptor object, binding it to the second local IP
> address
> > and setting the handler as usual. Just wanted to know if there are any
> > gotchas and if someone has tried this before.
> > Thanks,
> > Dhruv

Re: MINA on multihomed machine

Posted by Jeff MAURY <je...@gmail.com>.
That's more a java/socket problem.

You should use 0.0.0.0 as the binding address 

Jeff

—
Sent from Mailbox for iPhone

On Thu, Nov 28, 2013 at 4:50 AM, Dhruv Chopra <dh...@shephertz.com>
wrote:

> Hi,
> I wanted to know if MINA supports binding to multiple IP interfaces? So if
> my machine has 2 IP addresses (A and B) - can I make a single MINA process
> bind to both? It seems to me it should be possible by just creating a
> second NioSocketAcceptor object, binding it to the second local IP address
> and setting the handler as usual. Just wanted to know if there are any
> gotchas and if someone has tried this before.
> Thanks,
> Dhruv