HttpClient POST gets html page about 2.5x slower than browser
When I hit Search on London journey planner (e.g from Holborn to Savoy Pier), I get result in about 4 secs. When I do that with HttpClient using POST method, this line takes about 10 secs:
I开发者_JAVA技巧nputStream is = httpClient.execute(httpPost).getEntity().getContent();
Any ideas what can be the problem? I'm sending the same parameters as browser and I have also set User-Agent to Chrome.
Difficult to say, what is your problem, without seeing the code that performs the test and the measurement.
One suggestion, for troubleshooting with HttpClient: use logging.
And, to remove human errors from this comparison, it would be advisable to use some command-line tool (e.g. wget) instead of the browser to perform the comparative POST.
精彩评论