Building Pools of Common Resources with Poolboy
Explore how to build and manage pools of common resources with Poolboy in Elixir. Understand configuring worker pools for efficient concurrency, creating OTP GenServer workers, and invoking them concurrently to optimize resource use and scalability.
We'll cover the following...
Properties of poolboy
Poolboy is an Erlang application for sharing pools of common resources. Sometimes, programs need to use processes that take a while to start. In such instances, it’s best to have a pool of processes to share across a whole project. It’s ideal for situations where we need to throttle many requests down to a smaller number of resources. For example, most web servers run thousands of concurrent jobs through a handful of database connections, because those connections often consume a good amount of memory and take a while to start.
Since Poolboy is an OTP application, we already know how to use it. Just add a dependency, configure it in application.ex, and create an OTP server to do some work.
Creating a poolboy project
We’ll ...