tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David kerber <>
Subject Re: Peformance on socket reads
Date Thu, 14 May 2009 13:53:23 GMT
Rainer Jung wrote:
> On 14.05.2009 14:34, David kerber wrote:
>> req is my HttpServletRequest
>> iStream is a ServletInputStream
>> Then I have:
>>   len = req.getContentLength();
>>   b = new byte[ len ];
>>   iStream = req.getInputStream();
>>    /* this is the line 198 that the above thread dump is waiting for: */
>>   strLen = b, 0, len );
>>   iStream.close();
>> And then I convert b to a string and finish processing.  Is there
>> anything stupid I'm missing that would cause the .read() to be slow?  Or
>> is it just that my OS tcp/ip stack and/or network infrastructure appear
>> to be slow?  I did quite a bit of reading on InputStream performance, it
>> couldn't find any suggestions to improve on what I've already got (the
>> biggest one was to read the whole thing at once rather than
>> byte-by-byte, and I'm already doing that).
> socketRead0() most likely is really waiting for data to arrive. So now
> that you have an indication your performance is restricted by network,
> go ahead, install Wireshark and sniff a little traffic to verify, that
> your clients are really slow in sending the data (or invalidate that
> theory).
> Caution: you should do a couple of thread dumps and verify, that the
> code is waiting in socketRead0() in nearly all cases. Of course it's
> always possible that it is pure coincidence in a single dump.
Yes, I've taken several dumps over a couple of days, and multiple 
instances of this one are always there.  I'm pursuing the network issues 
in parallel with my any possible issues with my code. 

So my code looks reasonable in that respect?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message