On 11/9/11 6:04 AM, Anuradha wrote:

Emmanuel Lecharny<elecharny@...>  writes:

On 11/8/11 1:41 PM, Anuradha wrote:
Emmanuel Lecharny<elecharny@...>   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

Reply via email to