Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

java server's ability to accept a huge number of simultaneous connections

Thread view: 
shanky001@yahoo.com - 08 Feb 2006 21:38 GMT
I would appreciate some suggestions or pointers as to where to look
for, to increase a java server's ability to accept a huge number of
simultaneous connections.

Using the backlog feature in java's ServerSocket or NIO hasn't solved
my problem.

Details:
I have java socket server which accepts connections from clients. These
are persistent connections. I also have a thread pool in the server to
read/write to the clients
I did a performance test. I created 100 connections from 8 machines and
continuously read/write data using the connections.
I have problems creating lot of connections. even though the client
retries 50 times before it gives up.
Out of the attempted 800 client connections 300 seem to fail.

I am using the backlog feature in java's ServerSocket. It is set to
400.

My server is Windows 2000. Is there a setting to increase the number of
sockets for an application? Am I hitting some OS socket limit?

I have tried using NIO too. It doesn't seem to work.
Steve W. Jackson - 08 Feb 2006 22:36 GMT
> I would appreciate some suggestions or pointers as to where to look
> for, to increase a java server's ability to accept a huge number of
[quoted text clipped - 20 lines]
>
> I have tried using NIO too. It doesn't seem to work.

The backlog indicates the size of the queue of waiting connections.  I'd
think that 400 should be more than large enough for most uses.  But the
real question is probably what you're doing with the connections when
they arrive.  Are you handing them off *immediately* to some other
thread, thereby allowing the thread with the ServerSocket to check for
the next one, etc?  The longer it takes to hand it off and come back to
the accept() call, the more connection requests will get dumped.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

shanky001@yahoo.com - 17 Feb 2006 05:05 GMT
Steve,

Thanks a lot. That suggestion helped. Though the connections were being
handled by a different thread (eg. SocketHandler), the whole process
was taking a few milliseconds. I just changed it so that, the
connection is immediately dumped into a queue and there is a separate
thread that takes connections of the queue and creates the actual
socket handling thread (SocketHandler).

Thanks once again.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.