how to limit mapasyncunordered concurrency

22 views
Skip to first unread message

sirpy

unread,
Sep 25, 2016, 10:59:34 AM9/25/16
to Akka User List
The parallelism argument to mapasyncunordered doesn't seem to be effective.
According to the docs it seems like it will backpressure only if downstream also backpressures and futures count > parallelism.
On the other hand mapasync is limited by parallelism but it must wait for the first future in line to finish before starting the next one.
So my question is how can i achieve the same effect as with mapasync but using mapasyncunordered that the total amount of futures currently active by mapasyncunordered is limited by the parallelism argument and as soon as one future is done the next one will start (ie unordered).

Thanks
Hadar

Tal Pressman

unread,
Sep 26, 2016, 3:23:22 AM9/26/16
to Akka User List
Hi,

I think you're confusing some things here. Both mapAsync and mapAsyncUnordered limit the parallelism level in a similar way, the difference is whether or not they emit the results in the order they were received.
In other words, mapAsyncUnordered(8) will read 8 messages and start processing them. Once it has demand from the downstream, it will emit the results of any completed future, and then read another message and start processing it.

Tal
Reply all
Reply to author
Forward
0 new messages