Hello guys,
here goes pseudo code just to give background about composition I have at hand.
Source
.queue(…)
.via {
Http().newHostConnectionPool(…)
}
.toMat(Sink.ignore)(Keep.left)
.run()
So as you can see I have a queue
with own buffer settings, however then there is newHostConnectionPool
under the hood creating another buffer
with max-open-requests
size and throwing exceptions upon reaching the limit.
I tried to disable additional buffer ensuring that settings.maxOpenRequests
<= settings.maxConnections
val targetBufferSize = settings.maxOpenRequests - settings.maxConnections
if (targetBufferSize > 0) Flow[RequestContext].buffer(targetBufferSize, OverflowStrategy.backpressure)
but I’m occasionally getting:
BufferOverflowException("Exceeded configured max-open-requests…)
I’d like to have a natural back-pressure of my stream without PoolInterface’s buffer amortising spikes.
Which looks like impossible as otherwise with low values of max-open-requests
I would get BufferOverflowException instead of back-pressure.
Am I missing something?
How can I achieve natural back-pressure without exceptions?
Thanks for the help in advance.