GenStage vs pooling

With GenStage now in elixir 1.4 in which cases a library like poolboy would be a better fit and also which cases GenStage would be better?

4 Likes

They have distinct use cases. The main use case for GenStage is for getting a continuous stream of data into the system, poolboy and friends are about managing access to resources, such as files, ports or database connections.

So for example, even for a database case, you want to use poolboy around the database connection but the database connection itself could use GenStage, so it knows how to stream data whenever you need to work with large batches of data. When you have a particular connection streaming data with GenStage, you still need to be checkout from your pool, since you don’t want anyone else to issue it queries or start a transaction while you are streaming.

9 Likes

Heh, “poolink”.

3 Likes