appcues / mojito

An easy-to-use Elixir HTTP client, built on the low-level Mint library.
https://hexdocs.pm/mojito/Mojito.html
MIT License
349 stars 34 forks source link

Pools should handle connections to multiple hosts #9

Closed gamache closed 5 years ago

gamache commented 5 years ago

The current implementation of connection pooling in Mojito.Pool is a naive Poolboy setup, with the limitation that the pool should only be used to connect to a single protocol+host+port. Otherwise, the connection checked out of the pool is likely to be a connection to a different server, and we drop the existing connection and open another.

Consider a two-level pooling system, where a pool exists for each protocol+host+port we want to make requests to, and the process registry directs each request to its correct pool.

(Thanks to @ericmj for talking this through on Slack)