hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Cox <matthew.a....@gmail.com>
Subject Transient Slow Posts
Date Fri, 26 Apr 2013 20:34:52 GMT
Hi I'm using httpclient 3.0.1, which is beyond my control to change. The
problem I'm investigating involves several requests that take minutes to
resolve. I have access to the logs at the destination and I have narrowed
the problem down to between when we call HttpClient.execute() on our
PostMethod to the time it eventually shows up in the access logs on the
other end.

Here's the code in use:

System.setProperty("jsse.enableSNIExtension", "false");
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()},
new SecureRandom());
SSLContext.setDefault(ctx);

HttpConnectionManagerParams hcmParams = new HttpConnectionManagerParams();
hcmParams.setMaxTotalConnections(100);

MultiThreadedHttpConnectionManager connManager =  new
MultiThreadedHttpConnectionManager();
connManager.setParams(hcmParams);

HttpClient client = new HttpClient(connManager);

client.getState().setCredentials(
    new AuthScope(domain, 443, null),
    new UsernamePasswordCredentials(userName, password));


log.info("data=" + data);
PostMethod post = new PostMethod(url);
post.setRequestEntity(new
StringRequestEntity(data,"application/json","UTF-8"));

try
{
    client.executeMethod(post);
    response = post.getResponseBodyAsString();
    log.info("response: " + response);
}
catch (Exception e)
{
    throw e;
}
finally
{
    post.releaseConnection();
}

The data being submitting is not large, but would it help if the content
was chunked? Or do I need to explicitly set the content length? Of the
posts that are taking minutes long half of them are right around 1:35, with
others grouped around 3:10 and 4:40 oddly.  Any ideas what is going on?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message