On Mon, 2013-02-04 at 23:43 -0800, Oliver Lorenz wrote:
> Hi,
>
> We are using httpcore 4.0.1 and httpclient 4.0.3 in one of our products. In
> a clients test environment, we experience a big delay when calling
> writeTo().
>
Is there a reason for using such an outdated version of HttpClient?
> This is the code:
>
> httpClient = new DefaultHttpClient();
> HttpResponse httpResponse= httpClient.execute(post);
> log.debug("response code:" +
> httpResponse.getStatusLine().getStatusCode());
>
> HttpEntity responseEntity = httpResponse.getEntity();
> log.debug("got Entity");
>
> ByteArrayOutputStream baos = new ByteArrayOutputStream();
> responseEntity.writeTo(baos);
> log.debug("wrote everything to a stream.");
>
> From the log:
>
> 11:37:26,972 [router#12] DEBUG TERMINAL.SERVICE.CONNECTOR.LRTCS - response
> code:200
> 11:37:26,972 [router#12] DEBUG TERMINAL.SERVICE.CONNECTOR.LRTCS - got Entity
> ...
> 11:38:49,092 [router#12] DEBUG TERMINAL.SERVICE.CONNECTOR.LRTCS - wrote
> everything to a stream.
>
> The call writeTo() on the responseEntity took more than 80 sek, for a
> message of 560 kb.
>
> The strange thing is that I cannot reproduce their problem, with identical
> HW, in another network, even if I increase the message size to well above 3
> MB. No other threads, garbage collection or other activities occur on the
> system.
>
> As far as i understood the execute(), it blocks until the whole stream is
> read from the socket. Is that not the case? Can the performance of writeTo()
> be in some way depending on the network?
Absolutely. Smaller messages may fit into the network buffer in their
entirety. Larger messages most likely are transmitted with several
packets. Delivery of those packets can be affected by network
instability or congestion.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]