HTTPoison connection pooling


I have read so many posts on how to set connection pool size with HTTPoison but I am still quite confused on how to implement it, partly because the explanations and the steps provided in these online posts are all based on that which is specified in the HTTPoison documentation.

First of all, does HTTPoison do connection pooling by default? If yes, what is the default size of connection pools it creates?

In simple steps, how do I change the connection pool size in my POST requests, using HTTPoison?

I would be grateful for some assistance on this.

A lot of my POST requests end up timing out and I do not know what to do.

Thanks for the support in advance.



HTTPoison uses Hackney under the hood. Hackey will open / close connections on demand. However, you can switch it to use a pooled mode. By default, the pool size is 50. If you want to use this pool, you have to specify the pool option through HTTPoison, which will be passed into Hackney.

The way to specify the pool option can be found at

If your post requests are timing out, I’m not sure that a connection pool will help—it may actually make things worse. You could try to increase recv_timeout option, which defaults to 5s. Here’s an example of how to do that:

# Set to a 5s timeout (default), but this web request will delay for 7s
iex(3)> HTTPoison.get("")
{:error, %HTTPoison.Error{id: nil, reason: :timeout}}

# Now it's okay at 10s timeout
iex(4)> HTTPoison.get("", [], recv_timeout: 10_000)
   body: "",

Many thanks, @sb8244, for your response.
I will go with your suggestion.