Having recently worked on a project which required some more IO interaction than I\'m used to, I felt like I wanted to look past the regular libraries (Commons IO, in partic
Presumably the Apache HTTP client will be doing some buffering, with a smaller buffer. It will need a buffer to read the HTTP header reasonably, and probably handling chunked encoding.
Set a very large socket receive buffer. But really your performance will be limited by the network bandwidth, not CPU bandwidth. All you're doing really is allocating 1/3 of the network bandwidth to each downloader. I'd be surprised if you get much benefit.
To answer my own questions:
while() {}
loop that was waiting for the threads to finish. As it turns out, awaitTermination
is a much better alternative to wait for an Executor
to finish :)My immediate thought for best performance on Windows would be to use IO completions ports. What I don't know is (a) whether there are similar concepts in other OSes, and (b) whether there are any suitable Java wrappers? If portability isn't important to you, though, it may be possible to roll your own wrapper with JNI.