Poolboy vs DynamicSupervisor

processes
supervisor
dynamicsupervisor
poolboy

#1

I’m probably getting it wrong but what’s the point of using Poolboy(elixirschool example) if there’s a DynamicSupervisor with max_children option?


#2

One reason would be that Poolboy predates DynamicSupervisor.

The semantics aren’t really the same to me. With poolboy, you check in, do something with the process, and then check out.

With DynamicSupervisor, you’re just starting children with the same spec. It’s not keeping track of which children are busy/available (and starting overflow children as needed).


#3

Sorry for digging up an old thread, but I’d be interested in understanding why a checkin/checkout process would be better in some situations than just starting new children. Why would you want to keep track of whether children were busy/available if you just started children as needed?


#4

You might want to control exactly how many workers are present… in case workers use a limited resource.

For example, ecto use poolboy, and not dynamic supervisor, because access to the db is limited.