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.