DataInputStream's read method takes time to read from the stream

hi,

i am facing an acute problem regarding the socket stream .

My program connects to a socketserver and sends request to the socketserver and based on the response string i do some database updation. this is quite simple task and previously it took about 1 second to process 10-15 records. But now the problem is that it is taking 5 to 6 secs to process a single record ! I have gone through the log files and found that the main problem is that it is taking time to read response from the socketserver. it is taking 5 to 6 secs to read response from the socketserver . the remaining part of the program is completing in miliseconds.Peviously it took 1 secs to read 10-15 response string from the socketserver.My program runs on 8 cpu unix machine. The socketserver sends response string with semicolon at the end of the string.

here is the sample response string :CCSCD1=CHG:ACK;

I have used the datainputstream to receive response from the socket server.I have used the read(byte[]a) method.

here is the code :

private String receiveResponse()

throws ErrorReadingToSocketException {

byte[] l_objReadBuffer =new byte[20];

String l_strOutputString = null;

int _iNoOfBytesReceived=0;

try {

writeLog(Level.INFO,"Before Reading from the input stream");

_iNoOfDataBytesReceived=_objDataInputStream.read(l_objReadBuffer);

writeLog(Level.INFO,"After Reading from the input stream");

l_strOutputString =new String (l_objReadBuffer);

System.out.println("Response :: "+l_strOutputString );

}

catch(java.net.SocketTimeoutException e) {

l_strOutputString = NACK_RESPONSE;

}

catch(IOException e) {

throw(new ErrorReadingToSocketException());

}

catch(Exception e){

writeLog(Level.SEVERE,"Exception Occured -->"+e.getMessage());

}

finally {

l_objReadBuffer = null;

}

return l_strOutputString;

}

THE FOLLOWING OBSERVATION FOUND IN THE LOG FILE:

2007-07-27 15:42:24.368:General.SuperClass:writeLog:Before Reading from the input stream

2007-07-27 15:42:30.219:General.SuperClass:writeLog:After Reading from the input stream

you can see that it is taking about 6 secs to read a single response from the stream.

The socket server program belongs to third party. So we cannot do much exercise on that.

an important thing to observe that at very first time whent it receive response from the stram it took about only few miliseconds to read,but afterwards it is taking time ,although the response string it reads first time is little different from the next responses.

first time response:ACK;

Message was edited by:

AbhijitRoy2005

Message was edited by:

AbhijitRoy2005

[2818 byte] By [AbhijitRoy2005a] at [2007-11-27 11:56:54]
# 1

> this is quite

> simple task and previously it took about 1 second to

> process 10-15 records. But now the problem is that it

> is taking 5 to 6 secs to process a single record !

And you didn't change code?

Then it has nothing to do with the code. Something changed in the environment, not the code.

jschella at 2007-7-29 19:10:11 > top of Java-index,Core,Core APIs...
# 2

The Thrid party have made some version upgradation in their system,probably in the socketserver also.Since it is third party software we don't even know what upgradation have been done in thier system.

Is there any chance of version conflict ?

AbhijitRoy2005a at 2007-7-29 19:10:11 > top of Java-index,Core,Core APIs...
# 3

They have adversely changed the latency of these transmissions from their server. There's nothing you can do about that at your end except get on the phone or the e-mail and bring it to their attention.

ejpa at 2007-7-29 19:10:11 > top of Java-index,Core,Core APIs...