Using Redix and Poolboy to Connect to Redis with a Worker Pool in Elixir

Redis is a highly performant key-value store that often needs to be included in applications. When connecting to Redis or any database, we can set up a worker to manage the connection, but this may cause a bottleneck. Similarly, starting up a process to create a new connection every time we need to deal with a database is not a practical solution as we’ll saturate the connections rather quickly. The best approach is to maintain a pool of workers that each carries a connection to the database, and perform those operations through that worker’s pool.

The Redix library is a great Elixir client for Redis, and Poolboy is what we’ll be using for worker pools. In this video we’ll set up a Client using Redix, a GenServer to manage a single connection, and Poolboy to manage a pool of those GenServer workers.

Sign up for our newsletter

Get notified of any new episodes as we release them.

© 2020 QuantLayer, LLC. All rights reserved.