hi all,
there is a performace issue i'm facing in jatty 6.x.
once my servlets doXXX() method is complete, it takes jetty near about 40-50 msec to finish the job.
the reason i figured out is due to the processing logic written in HttpConnection.handle() method.
below is the code part which i believe is the performance bottleneck.
---------------------------------------------------------------------------------------
while (_generator.isCommitted() && !_generator.isComplete())
{
long written=_generator.flush();
io+=written;
if (written<=0)
break;
else if (_endp.isBufferingOutput())
_endp.flush();
}
// Flush buffers
if (_endp.isBufferingOutput())
{
_endp.flush();
if (!_endp.isBufferingOutput())
no_progress=0;
}
if (io>0)
no_progress=0;
else if (no_progress++>=2)
return;
}
}
---------------------------------------------------------------------------------------
here i'm looping 2 times extra even if the payload to be sent is quite small and one iteration would have served the purpose.
this is causing a performance degradation of about 25% which is quite a big figure as listed below.
[2008-12-11 14:57:17.19] INFO 000000000000 GLOBAL_SCOPE PSHttpServlet process() completed===>2008-12-11 14:57:17.190
[2008-12-11 14:57:17.242] INFO 000000000000 GLOBAL_SCOPE ConduitStreamListener handlenewconnection conn.handle() completed===>2008-12-11 14:57:17.242
here as we can see, even though the processing is complete, still the time take by handle method to finish is about 52 msec.
i believe this is a bug and needs to be fixed. please feel free to suggest any other way which can help to increase the performance.