Hi Brett, > I use HttpClient to upload a huge file(198M) to > server. I use RequestEntity and PostMethod to do that.
What RequestEntity? MultipartRequestEntity with a File part? InputStreamRequestEntity? Or one you wrote yourself? > It took HttpClient 2 minutes to upload the file. > Compare to JDK HttpURLConnection(30 seconds), I find > HttpClient is much slower. Does anyone know how to > improve upload speed using HttpCLient? HttpClient usually streams files, using chunked encoding. Chunked encoding adds a little overhead, but that won't amount to a factor of 4. Streaming means that the time to load the file into memory will be included in the request execution time. What excatly does your timing check for HttpURLConnection and for HttpClient? Is it a http or https URL? If memory consumption doesn't matter to you, you can always load the 198 MB into memory first and send it from there. Just start the timing *after* loading into memory, and you'll find the execution time reduced significantly ;-) Last time I checked, HttpURLConnection would always buffer the request body in memory, to determine the content length before sending. But that may have changed with JDK 1.5. Which JDK are you using? cheers, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
