You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Stephen <li...@126.com> on 2011/05/23 12:34:40 UTC
HttpClient Performance issue
I use HttpClient to upload data to the Windows Azure, it use four threads to work together, but the performance is slow.
I use the ThreadSafeClientConnManager to manage the connection.
static {
SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
schemeRegistry.register(new Scheme("https", 443, SSLSocketFactory.getSocketFactory()));
cm = new ThreadSafeClientConnManager(schemeRegistry);
cm.setMaxTotal(100);
cm.setDefaultMaxPerRoute(10);
}
and the HttpClient parameters set like following:
DefaultHttpClient httpClient = new DefaultHttpClient(cm);
httpClient.getParams().setParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, true);
httpClient.getParams().setParameter(CoreConnectionPNames.TCP_NODELAY, true);
httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 50*1000);
When I add the log, it seems the time was cost at http.execute method.
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.136 length:1,048,576 type1 time:1,400
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.137 length:1,048,576 type1 time:2,207
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.139 length:1,048,576 type1 time:2,501
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.138 length:1,048,576 type1 time:2,633
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.148 length:1,048,576 type1 time:1,899
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.149 length:1,048,576 type1 time:2,157
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.151 length:1,048,576 type1 time:2,461
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.150 length:1,048,576 type1 time:2,672
It seems the first thread finished first, then the other thread work again. but in the log, httpClient.execute method is called almost the same time.
I don't know what's the problem, is there any parameter I didn't set probably?
Thanks for any help.
Re: Re:Re: HttpClient Performance issue
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2011-05-23 at 20:26 +0800, Stephen wrote:
> Olegk, thanks for you quick reply.
>
>
> Maybe my question is not clear, and I can't say that httpclient's performance is slow.
> HttpClient is very good, I think there maybe some configurations I didn't set properly, So I want to ask for some help.
>
>
> In my log:
> name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.136 length:1,048,576 type1 time:1,400
> name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.137 length:1,048,576 type1 time:2,207
> name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.139 length:1,048,576 type1 time:2,501
> name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.138 length:1,048,576 type1 time:2,633
>
>
> The four threads started together, but why the first thread finished first?
> Almost all of the test was the same result, the first completed thread is much quickly than the other threads.
>
There is NO way to say for sure because we simply have NO control over
the remote site you are uploading files unto. We can only be guessing.
As I already said my guess was Microsft Azure was throttling (slowing
down) concurrent connections from the same IP address in order to
prevent one client from clogging up too much bandwidth.
>
> Is there any performance guide for HttpClient 4.1?
>
HttpClient 4.x default settings are reasonable enough. There is really
not much material to put into a guide like that.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re:Re: HttpClient Performance issue
Posted by Stephen <li...@126.com>.
Olegk, thanks for you quick reply.
Maybe my question is not clear, and I can't say that httpclient's performance is slow.
HttpClient is very good, I think there maybe some configurations I didn't set properly, So I want to ask for some help.
In my log:
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.136 length:1,048,576 type1 time:1,400
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.137 length:1,048,576 type1 time:2,207
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.139 length:1,048,576 type1 time:2,501
name:E:\Softwares\com.google.gdt.eclipse.suite.3.6.update.site_2.3.0.zip.138 length:1,048,576 type1 time:2,633
The four threads started together, but why the first thread finished first?
Almost all of the test was the same result, the first completed thread is much quickly than the other threads.
Is there any performance guide for HttpClient 4.1?
Thanks again.
At 2011-05-23 18:58:34,"Oleg Kalnichevski" <ol...@apache.org> wrote:
>On Mon, 2011-05-23 at 18:34 +0800, Stephen wrote:
>> I use HttpClient to upload data to the Windows Azure, it use four threads to work together, but the performance is slow.
>>
>
>What do you mean by 'slow'? Slow compared to what? Besides, Windows
>Azure might actually throttle throughput of concurrent connections
>originating from the same host making your performance numbers
>completely unreliable. Performance testing against a remote host makes
>no sense of whatsoever.
>
>I am not aware of any performance issues with HttpClient. It is known
>to be reasonably fast [1] but I will happily look at the results that do
>not involve an external site.
>
>Oleg
>
>[1]
>http://wiki.apache.org/HttpComponents/HttpClient3vsHttpClient4vsHttpCore
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
Re: HttpClient Performance issue
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2011-05-23 at 18:34 +0800, Stephen wrote:
> I use HttpClient to upload data to the Windows Azure, it use four threads to work together, but the performance is slow.
>
What do you mean by 'slow'? Slow compared to what? Besides, Windows
Azure might actually throttle throughput of concurrent connections
originating from the same host making your performance numbers
completely unreliable. Performance testing against a remote host makes
no sense of whatsoever.
I am not aware of any performance issues with HttpClient. It is known
to be reasonably fast [1] but I will happily look at the results that do
not involve an external site.
Oleg
[1]
http://wiki.apache.org/HttpComponents/HttpClient3vsHttpClient4vsHttpCore
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org