Difference Between Http().singleRequest and Http().superPool

What is difference between Http().singleRequest() and Http().superPool()? Is there any specific scenario when one is preferred over other.

We have specific scenario where we have Akka Http based rest service, the purpose of the service is to validate incoming request against five external services before posting to another API.

Two of five external services are rest based and other three are soap based (same web service but three different operations). Currently each of the client code uses Http().singleRequest() and because of the volume we see max-open-request error very frequently, in order to mitigate we are running multiple instances.

I am wondering would using Http().superPool()be better option here? Keep in mind after the validation we are calling another API to post the request.

Regards,

Syed Farhan Ali

Hi Syed,

in both cases, when using singleRequest or superPool, requests will be routed through the same cached host connection pool. The difference is in the APIs. With superPool you get back a Flow which will make sure that it will not take more requests than the pool is able to handle, because of the backpressure.

In contrast, singleRequest is a fire-and-forget style API. Every time you call that method it needs to put the request somewhere. The request is either handled by the connection pool if there are free slots available, or it is buffered. And if there is no more free space in the buffer, you get the exception you have been seeing.

Thanks for your reply @2m.