Hi, our team uses `EntityUtils.toByteArray` method in 
`org.apache.httpcomponents:httpcore:4.4.15` to implement HTTP client to 
download a file.

We found that file download gets very slow when downloading a file of ~1.7 GB. 
Based on our investigation, the performance of copying the response to a byte 
array is significantly deteriorated in the case of large file download.
And, we also found that this perfomance problem is improved by using Java's 
`InputStream.readAllBytes` instead.

You can find the details of our investigation with benchmarks in the following 
repository.
* https://github.com/deftfitf/httpcomponent-entitiyutils-benchmarks

Based on this content, I believe that there is a room of improvement regarding 
the performance of `EntityUtils.toByteArray`.


Best regards,

Junya Ishida

Reply via email to