https://kotlinlang.org logo
#rx
Title
# rx
d

dimsuz

07/07/2020, 6:51 PM
What happens by default in absense of backpressure support? For example here:
publishSubject.concatMap { Observable.delay(3000) }
If subject will very quickly emit a lot of items, what happens? Will they get buffered up to a certain point? Or not at all? Can one expect that quickly emitting 3 items will be OK, but 1 000 000 items will throw MissingBackrpressure? Where's that point when OK becomes an exception? :) I tried searching javadoc for this info, but didn't succeed. If this is documented, please point me to the place in the docs.
a

alexsullivan114

07/07/2020, 8:38 PM
Observable
(and `Subject`s) will buffer forever until an OOM is hit. You should only receive a
MissingBackpressureException
when using a
Flowable
d

dimsuz

07/07/2020, 8:49 PM
I see! Thanks for clarification!
u

ursus

07/08/2020, 3:53 AM
I might be making this up but there is some internal config for the buffer, its 256 or something
g

gildor

07/08/2020, 5:30 AM
It’s only default buffer size ( I think it’s 128 values)
a

alexsullivan114

07/08/2020, 1:33 PM
My understanding is that `Observable`s will just keep buffering forever...For
Flowable
I know there's some type of internal, fixed size buffer that can buffer some amount (maybe 128/256?) before it crashes
u

ursus

07/08/2020, 10:08 PM
if you look at the sources, almost all operators have a buffer overload, `
Copy code
BUFFER_SIZE = Math.max(1, Integer.getInteger("rx2.buffer-size", 128));
`
I wonder what happens after that .. does it block? or throw?
a

alexsullivan114

07/10/2020, 1:07 PM
That's interesting. I know there's some internal buffering with the
observeOn
operator to improve performance for bursty sources but I'm not sure about those internal buffers
9 Views