Akka-Stream implementation slower than single threaded implementation

Akka Streams is using asynchronous message passing between Actors to implement stream processing stages. Passing data across an asynchronous boundary has an overhead that you are seeing here: your computation seems to take only about 160ns (derived from the single-threaded measurement) while the streaming solution takes roughly 1µs per element, which is dominated by the … Read more

How to correctly read Flux and convert it to a single inputStream

This is really not as complicated as other answers imply. The only way to stream the data without buffering it all in memory is to use a pipe, as @jin-kwon suggested. However, it can be done very simply by using Spring’s BodyExtractors and DataBufferUtils utility classes. Example: private InputStream readAsInputStream(String url) throws IOException { PipedOutputStream … Read more