我有两个服务器与HTTP通信:查看部分客户端代码
PostMethod postMethod = new PostMethod(strURL);
int bodylength=UCIPBodyRequestGen.toStringBodyRequest(_request, DEFAULT_CHARSET).length();
setRequestHeader(postMethod,bodylength);
postMethod.setRequestBody(requestBody);
HttpClient myClient = new HttpClient();
myClient.setConnectionTimeout(mcf.getTimeout());
myClient.setTimeout(mcf.getTimeout());
int statusCode = myClient.executeMethod(postMethod);
responseBody=postMethod.getResponseBodyAsString();
我在一些请求~500ms
中有一点延迟,另一个平均值是~20ms
TCPDUMP show that the delay is in TCP FIN-ACK
2014-12-23 09:38:59.069230 HTTP/XML 1534 POST /Servlet HTTP/1.1
2014-12-23 09:38:59.070450 HTTP 514 HTTP/1.1 200 OK
2014-12-23 09:38:59.110758 TCP 66 14783?9770 [ACK] Seq=1469 Ack=450 Win=33920 Len=0 TSval=2321949059 TSecr=2321949019
2014-12-23 09:38:59.602623 TCP 66 14783?9770 [FIN, ACK] Seq=1469 Ack=450 Win=33920 Len=0 TSval=2321949551 TSecr=2321949019
关于这次延误有什么线索吗?
FIN确认字符包组装为:
在第一个服务器的FIN和确认字符之间,是另一个服务器的确认字符和FIN对,因此这种连接终止阶段(四次握手)需要时间来发生。
问候