You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Anuradha <an...@yahoo.com> on 2011/11/08 12:27:16 UTC

apache mina server with 4 ports opened

Hi,

I have written an apache server program in which, i am presently listening on 
one port 9123.
How can we modify the server program to listen on 4 ports ,and if we have 
100requests opened from clients ,each port should process 25 requests,and this 
handling should be done in round robin fashion.


any idea pls help me


Re: apache mina server with 4 ports opened

Posted by Anuradha <an...@yahoo.com>.
Jean-Yves Linet <jy...@...> writes:

> 
> Thanks for you r help ,very nice of u 





Re: apache mina server with 4 ports opened

Posted by Jean-Yves Linet <jy...@gmail.com>.
You need 5 servers. The fifth is for loadbalancing protocol.
1- client send a request to the loadbalancing server which answer with the
address of the server to use.
2- client connect to this server.
Loadbalancing server need to be awared of the number of established
connection on each server.

2011/11/9 Anuradha <an...@yahoo.com>

> Emmanuel Lecharny <el...@...> writes:
>
> >
> sorry to trouble u Emmanuel , I want load balencer for apache mina server,
> how to create 4 instances of server  in acceptor and route
>
>
>
> Thank u
>
>


-- 
Jean-Yves LINET

Re: apache mina server with 4 ports opened

Posted by Anuradha <an...@yahoo.com>.
Emmanuel Lecharny <el...@...> writes:

> 
sorry to trouble u Emmanuel , I want load balencer for apache mina server, 
how to create 4 instances of server  in acceptor and route 



Thank u


Re: apache mina server with 4 ports opened

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 11/9/11 7:23 AM, Anuradha wrote:
> Emmanuel Lecharny<el...@...>  writes:
> can you pls give me any idea on how to write load-balance the incoming
> requests on the server
Try google ...


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


Re: apache mina server with 4 ports opened

Posted by Anuradha <an...@yahoo.com>.
Emmanuel Lecharny <el...@...> writes:
> 
can you pls give me any idea on how to write load-balance the incoming 
requests on the server

Thank you


Re: apache mina server with 4 ports opened

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 11/9/11 6:04 AM, Anuradha wrote:
>
> Emmanuel Lecharny<el...@...>  writes:
>
>> On 11/8/11 1:41 PM, Anuradha wrote:
>>> Emmanuel Lecharny<el...@...>   writes:
>>>
>>>> On 11/8/11 12:27 PM, Anuradha wrote:
>>>>> Hi,
>>>>>
>>>>> I have written an apache server program in which, i am presently
> listening
>>> on
>>>>> one port 9123.
>>>>> How can we modify the server program to listen on 4 ports ,and if we have
>>>>> 100requests opened from clients ,each port should process 25 requests,and
>>> this
>>>>> handling should be done in round robin fashion.
>>>> Assuming you are using MINA 2, you can bind as many port as you like,
>>>> using the :
>>>> *void bind(SocketAddress firstLocalAddress, SocketAddress... addresses)
>>>> throws IOException*
>>>> method, or the
>>>> void bind(Iterable<? extends SocketAddress>   localAddresses) throws
>>>> IOException
>>>> method.
>>>>
>>> Thank u Emmanuel
>>>
>>> I have written
>>> acceptor.bind(new InetSocketAddress(9123),new InetSocketAddress(9124),new
>>> InetSocketAddress(9125),new InetSocketAddress(9126));
>>> to  accept connections on 4 ports, but i am not sure how client requests
> are
>>> distributed to these ports  do we need to do anything here to load balence
> on
>>> each port so that each port is used
>> The server just *listens* to ports. It has no idea how to load balance
>> what comes from clients. It's up to you to add a load balancer on top of
>> the server.
>>
>> Now, it's very strange to expect that load balancing using 4 different
>> ports will help. What exactly are you trying to do ?
>>
> on the server side we know we have 4 ports opened for same service,but on
> client side when we connect we  use only one server address and port.
>
> so if i have 400 clients connecting to my server using
> connector.connect(InetSocketAddress) all clients will be connected to one port
> say 9123, but how can we distribute the incomming requests to 4 portas  i.e
> each handling 100 clients
I still don't get what you are trying to do. Just because your server 
listen to four different ports won't help to either scale or load 
balance anything. The server is still absorbing the exact same load than 
if it were listening on one unique port.

It would be a different story if you were to install four instances of 
your server, listening on 4 different ports. In this case, you will need 
a system to load-balance the incoming requests on top of your servers.

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


Re: apache mina server with 4 ports opened

Posted by Anuradha <an...@yahoo.com>.
 
Emmanuel Lecharny <el...@...> writes:

> 
> On 11/8/11 1:41 PM, Anuradha wrote:
> > Emmanuel Lecharny<el...@...>  writes:
> >
> >> On 11/8/11 12:27 PM, Anuradha wrote:
> >>> Hi,
> >>>
> >>> I have written an apache server program in which, i am presently 
listening
> > on
> >>> one port 9123.
> >>> How can we modify the server program to listen on 4 ports ,and if we have
> >>> 100requests opened from clients ,each port should process 25 requests,and
> > this
> >>> handling should be done in round robin fashion.
> >> Assuming you are using MINA 2, you can bind as many port as you like,
> >> using the :
> >> *void bind(SocketAddress firstLocalAddress, SocketAddress... addresses)
> >> throws IOException*
> >> method, or the
> >> void bind(Iterable<? extends SocketAddress>  localAddresses) throws
> >> IOException
> >> method.
> >>
> > Thank u Emmanuel
> >
> > I have written
> > acceptor.bind(new InetSocketAddress(9123),new InetSocketAddress(9124),new
> > InetSocketAddress(9125),new InetSocketAddress(9126));
> > to  accept connections on 4 ports, but i am not sure how client requests 
are
> > distributed to these ports  do we need to do anything here to load balence 
on
> > each port so that each port is used
> The server just *listens* to ports. It has no idea how to load balance 
> what comes from clients. It's up to you to add a load balancer on top of 
> the server.
> 
> Now, it's very strange to expect that load balancing using 4 different 
> ports will help. What exactly are you trying to do ?
> 
on the server side we know we have 4 ports opened for same service,but on 
client side when we connect we  use only one server address and port.

so if i have 400 clients connecting to my server using 
connector.connect(InetSocketAddress) all clients will be connected to one port 
say 9123, but how can we distribute the incomming requests to 4 portas  i.e 
each handling 100 clients






Re: apache mina server with 4 ports opened

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 11/8/11 1:41 PM, Anuradha wrote:
> Emmanuel Lecharny<el...@...>  writes:
>
>> On 11/8/11 12:27 PM, Anuradha wrote:
>>> Hi,
>>>
>>> I have written an apache server program in which, i am presently listening
> on
>>> one port 9123.
>>> How can we modify the server program to listen on 4 ports ,and if we have
>>> 100requests opened from clients ,each port should process 25 requests,and
> this
>>> handling should be done in round robin fashion.
>> Assuming you are using MINA 2, you can bind as many port as you like,
>> using the :
>> *void bind(SocketAddress firstLocalAddress, SocketAddress... addresses)
>> throws IOException*
>> method, or the
>> void bind(Iterable<? extends SocketAddress>  localAddresses) throws
>> IOException
>> method.
>>
> Thank u Emmanuel
>
> I have written
> acceptor.bind(new InetSocketAddress(9123),new InetSocketAddress(9124),new
> InetSocketAddress(9125),new InetSocketAddress(9126));
> to  accept connections on 4 ports, but i am not sure how client requests are
> distributed to these ports  do we need to do anything here to load balence on
> each port so that each port is used
The server just *listens* to ports. It has no idea how to load balance 
what comes from clients. It's up to you to add a load balancer on top of 
the server.

Now, it's very strange to expect that load balancing using 4 different 
ports will help. What exactly are you trying to do ?


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


Re: apache mina server with 4 ports opened

Posted by Anuradha <an...@yahoo.com>.
Emmanuel Lecharny <el...@...> writes:

> 
> On 11/8/11 12:27 PM, Anuradha wrote:
> > Hi,
> >
> > I have written an apache server program in which, i am presently listening 
on
> > one port 9123.
> > How can we modify the server program to listen on 4 ports ,and if we have
> > 100requests opened from clients ,each port should process 25 requests,and 
this
> > handling should be done in round robin fashion.
> 
> Assuming you are using MINA 2, you can bind as many port as you like, 
> using the :
> *void bind(SocketAddress firstLocalAddress, SocketAddress... addresses) 
> throws IOException*
> method, or the
> void bind(Iterable<? extends SocketAddress> localAddresses) throws 
> IOException
> method.
> 
Thank u Emmanuel
 
I have written  
acceptor.bind(new InetSocketAddress(9123),new InetSocketAddress(9124),new 
InetSocketAddress(9125),new InetSocketAddress(9126));
to  accept connections on 4 ports, but i am not sure how client requests are 
distributed to these ports  do we need to do anything here to load balence on 
each port so that each port is used 






Re: apache mina server with 4 ports opened

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 11/8/11 12:27 PM, Anuradha wrote:
> Hi,
>
> I have written an apache server program in which, i am presently listening on
> one port 9123.
> How can we modify the server program to listen on 4 ports ,and if we have
> 100requests opened from clients ,each port should process 25 requests,and this
> handling should be done in round robin fashion.

Assuming you are using MINA 2, you can bind as many port as you like, 
using the :
*void bind(SocketAddress firstLocalAddress, SocketAddress... addresses) 
throws IOException*
method, or the
void bind(Iterable<? extends SocketAddress> localAddresses) throws 
IOException
method.


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