dcsimg
Minimise number of Threads
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jitendra_Kharche
Posted On:   Monday, July 15, 2002 06:54 AM


My Java application needs thousands of threads to be created on a web server. This leads in crashing the server after reaching a certain limit. Every thread is dedicated for a socket to perofrm socket read/write.


Can anybody suggest me some alternative way to minimise the number of threads and at the same time can hold those many number of sockets.


Thanks in advance.

Re: Minimise number of Threads

Posted By:   Simon_Ablett  
Posted On:   Monday, July 15, 2002 08:11 AM

When a connection to a server fails (for whatever reason) the responsibility for restoring the connection should lie with the client and not with the server. That way the server can close its end of the socket and end the run of the associated thread immediately.

Regards.

Re: Minimise number of Threads

Posted By:   Anonymous  
Posted On:   Monday, July 15, 2002 07:18 AM

Don't keep the sockets open if you don't need to. Start the thread to handle a connection, read/write from the socket, then terminate the thread.
About | Sitemap | Contact