Hi,

I'm facing some performance issues with Tomcat. I've deployed a very simple
Web service on Tomcat, and when I call an operation of this Web service, the
HTTP response is fragmented into many TCP segments. This sounds normal,
since the HTTP response is transmitted with the "chunked" transfer coding
(the response is fragmented even though it would fit in just one TCP
segment).

When the HTTP response is split, Tomcat sends just the HTTP header and the
beginning of the response content to the client. It only sends the remaining
parts of the content when the client sends an ACK acknowledging that the
first segments where received correctly. Due the delayed ACK implementation
on Linux, the client will delay the ACK for a quite long period of time.
This causes a long pause in the communication, increasing significantly (up
to 400%) the round trip time for Web service calls.

Here are the TCP segments involved in a HTTP request to a Web service (Time
was 0.0 at the beginning of the segment capture):

Time (absolute)              Direction
Content
0.155986000                  client > Tomcat                       HTTP
request header
0.156014000                  client > Tomcat                       HTTP
request body (SOAP envelope)
0.160224000                  Tomcat > client                       HTTP
response header
0.160255000                  Tomcat > client                       HTTP
response body (part 1)
0.160265000                  Tomcat > client                       HTTP
response body (part 2)
0.160276000                  Tomcat > client                       HTTP
response body (part 3)
0.199794000                  client > Tomcat                       TCP ACK
0.199817000                  Tomcat > client                       HTTP
response body (part 4, the last one)
0.202165000                  client > Tomcat                       TCP ACK

As the data above show, Tomcat doesn't send the last part of the response
until it receives an ACK from the client. And the client delays a lot
(almost 40ms) before sending the (first) ACK. One option to solve this
problem would be to turn off the delayed ACK on the client. Although, as far
as I'm concerned, this is not possible in Linux. I've tried setting
tcpNoDelay="true" on Tomcat, but the problem still persists. Even with
tcpNoDelay enabled, Tomcat still doesn't send the last part of the message
before receiving the ACK.

Is there any way to force Tomcat not to wait the ACK from the client to send
the last part of a HTTP response?

Thanks in advance,

--
Ivan Neto

Reply via email to