On Wed, 2023-02-08 at 19:21 +0900, 石田隼也 wrote: > 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
One should _never_, _never_, ever consume HTTP message body as an array of bytes. Never. Especially when message body can be greater than 1MB. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
