Java performance prblm ..PLz help me

Hi

im running a java mutithreaded application, its small server it can handle aroung 200 clients.but after reaching 60-70cliemts .this clients r applets .server going to ideal or it will crash after one to two hour.i am giving aroung 730mb for that application.in the same machine Tomcat is running. If anybody knows more abt this prblm .Help me

[359 byte] By [jobina] at [2007-11-27 5:51:33]
# 1
show the codeif it's too long you don't have to paste it all, just give the necessary
calvino_inda at 2007-7-12 15:40:57 > top of Java-index,Java Essentials,Java Programming...
# 2
Do you get an error message prior to the crash? What does it say? Have you tried to profile the application?Kaj
kajbja at 2007-7-12 15:40:57 > top of Java-index,Java Essentials,Java Programming...
# 3

most of the Exception im catching and displaying in the console, this server application have a GUI window.that will vanish suddenly out printing any exception in the console.once we restarted it will work.but after some 3-4 hr it will become ideal or crashes.

this server is connected to a some other c process thorugh port. lots of threads are running inside the server.everthing inside the try-catch.if there is small no of clients connetc to the server thn this server will work fine.

jobina at 2007-7-12 15:40:57 > top of Java-index,Java Essentials,Java Programming...
# 4

> most of the Exception im catching and displaying in

> the console, this server application have a GUI

> window.that will vanish suddenly out printing any

> exception in the console.once we restarted it will

> work.but after some 3-4 hr it will become ideal or

> crashes.

> this server is connected to a some other c process

> thorugh port. lots of threads are running inside the

> server.everthing inside the try-catch.if there is

> small no of clients connetc to the server thn this

> server will work fine.

Thank you for repeating the rambling of your original post. Do you plan on showing us any code or any stacktraces at any point?

cotton.ma at 2007-7-12 15:40:57 > top of Java-index,Java Essentials,Java Programming...
# 5

void AcceptClient(Socket oClientSocket)

throws Exception

{

try

{

boolean bConnectionRequest = CheckForRequestRouterConnection(oClientSocket);

if(bConnectionRequest)

{

try

{

oClientSocket.close();

connectToRequestRouter();

oMainScreen.append("Connected \n");

oStream.sendRequest(oClientThreads.size());

}

catch(Exception exp)

{

}

}

else

{

CServerRequestoServerRq;

ObjectInputStreamoInStream=new ObjectInputStream( oClientSocket.getInputStream() );

ObjectOutputStream oOutStream =new ObjectOutputStream( oClientSocket.getOutputStream() );

CUserStreamInfooUserStream =new CUserStreamInfo();

oUserStream.oInStream=oInStream;

oUserStream.oOutStream=oOutStream;

oUserStream.oClntSocket=oClientSocket;

try

{

oServerRq=( CServerRequest ) oInStream.readObject();

}

catch(Exception e)

{

ReleaseResources( oUserStream );

return;

}

oUserStream.oAccountId=oServerRq.oAccountId;

ClientNotifyThread oClientNotifyThread = new ClientNotifyThread(oServerRq.oAccountId, oUserStream.oOutStream, oServerRq.oAccountId );

oClientThreadList.put(oServerRq.oAccountId, oClientNotifyThread);

String[] sSocketProp = new String[4];

sSocketProp[0] = (oClientSocket.getInetAddress()+"").substring(1);

sSocketProp[1] = oClientSocket.getPort()+"" ;

sSocketProp[2] = oClientSocket.getInetAddress().getHostName();

sSocketProp[3] = ""+oClientSocket.isConnected();

oDisplayTable.put(oServerRq.oAccountId, sSocketProp);

if( SanityCheck(oServerRq,

oUserStream) )

{

switch( oServerRq.iReqType )

{

case NESTconstants.QUOTES:

oMainScreen.append(oServerRq.oAccountId + " : connected" + "\n");

oUserStreamHash.put( oServerRq.oAccountId,

oUserStream );

oClientThreads.put( oServerRq.oAccountId,

new ClientThread( this,

oUserStream,

oServerRq.iDDInteractive,

oServerRq.sPortfolio));

UpdateTable();

boolean bSubscribed =false;

OMMisc.OMlog( oUserStream.oAccountId + " : Got Connected from "+oClientSocket.getInetAddress()+" @ "+new Date());

oUserStream.oDDInteractive=sDDInteractive;

oOmneLink.GetPortfolioNames(oServerRq.oAccountId);

oOmneLink.SubscribeForLogMsgs( oServerRq.oAccountId ,

oUserStream.oDDInteractive );

if( bGeneralDataFlag )

{

bGeneralDataFlag =false;

oOmneLink.SubscribeForIndex(); // will work for both index and exchng time

}// if( bSensexFlag )

oOmneLink.GetBSELastIndex();

oOmneLink.GetNSELastIndex();

oMainScreen.append(oServerRq.oAccountId + "Connected @ "+new Date()+ "\n");

oStream.sendRequest(oClientThreads.size());

}// switch( iReqType )

}// if( SanityCheck() )

}

}// try

catch( Exception e )

{

e.printStackTrace();

}// catch()

}// method AcceptClient()

this is the code to accept new client. this will calld in side

public voidrun()

{

while( true )

{

try

{

AcceptClient( oServerSocket.accept() );

}

catch( Exception e )

{

System.out.println(e);

//OMMisc.OMlog( "Run ( AcceptClient ) " + e.toString() );

}// catch()

}// while( true ) loop

}// method run()

now im running this application as Java Hotspot server VM.from today morning to till now no crashing.previosly it was running as normal application.that can give any changes(avoind crashes).

with regards

Jobin John

jobina at 2007-7-12 15:40:57 > top of Java-index,Java Essentials,Java Programming...