# Max-open-requests and natural back-pressure

**URL:** <https://discuss.akka.io/t/max-open-requests-and-natural-back-pressure/9424>\
**Category:** Akka HTTP\
**Tags:** akka-http\
**Created:** [January 18, 2022, 1:17pm UTC](https://discuss.akka.io/t/max-open-requests-and-natural-back-pressure/9424 "2022-01-18T13:17:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![t3hnar](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/t3hnar/32/2764_2.png) [@t3hnar](https://discuss.akka.io/u/t3hnar)\
**Post date:** [January 18, 2022, 1:17pm UTC](https://discuss.akka.io/t/max-open-requests-and-natural-back-pressure/9424/1 "2022-01-18T13:17:05Z")

</div>

Hello guys,

here goes pseudo code just to give background about composition I have at hand.

```auto
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`

```auto
val targetBufferSize = settings.maxOpenRequests - settings.maxConnections
      if (targetBufferSize > 0) Flow[RequestContext].buffer(targetBufferSize, OverflowStrategy.backpressure)

```

but I’m occasionally getting:

```auto
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.
