general-CbIC
Poolex - A library for managing pools of workers
Hi ![]()
Poolex is an Elixir library for managing pools of workers.
In short, this is a poolboy written in Elixir.
When I started this project, I had the following goals:
- To solve the problem of missing documentation of public interfaces and “official” library usage examples.
- To bring this library back to life.
poolboyis not actively maintained. Even ifpoolboyis written perfectly, there may be a chance of incompatible OTP changes in the future or the appearance of new features we’d like to use. - Try to rewrite this library in Elixir. It’s not a problem, but I’d like to use Elixir dependencies when I’m writing in Elixir.
- To add the ability to use different strategies for getting a worker. I think a developer may have more needs than just choosing a
LIFO/FIFO. So I added the ability to describe and use implementations for operating withworkerandcallerprocess queues.
Some project links:
Most Liked
general-CbIC
Release 1.0.0
The new monitoring implementation no longer restricts the use of pool_id as an atom. Now you can use any valid GenServer.name() as pool_id.
PromEx plugin also bumped to v1.0.0.
Thanks to @spacebat and @al2o3cr for their discussion, this helped me realize the naming problem ![]()
general-CbIC
general-CbIC
Release 0.10.0
Two new functions, add_idle_workers! and remove_idle_workers!, allow you to control the pool’s size at runtime.
For example, this is how you can add additional workers to an already running pool:
Poolex.add_idle_workers!(:my_lovely_pool, 5)
Dynamic pool size management can help you utilize resources more efficiently, depending on the workload.
general-CbIC
Release 1.2.0
And a few more improvements!
These are mainly related to library maintenance improvements:
- added Elixir version 1.18 on CI;
- tests rewritten with new ExUnit parameterization feature;
- tests no longer throw many expected errors into the console when executed.
However, there has also been a slight improvement in the library’s use. Now, during initialization, there is no need to explicitly specify pool_id since, judging by user feedback, it often coincides with worker_module. Therefore, you can not set pool_id; by default, it will have a value equal to worker_module.
Example:
Poolex.start_link(worker_module: MyLovelyWorker, workers_count: 10)
Poolex.run(MyLovelyWorker, fn pid -> do_something(pid) end)
general-CbIC
Release 1.1.0
Several small improvements have been made that were mentioned above. Thank you very much for your comments!
- The unnecessary Agent process has been removed from the monitoring logic.
Poolex.get_state/1deprecated in favor of:sys.get_state/1.- Poolex processes now have higher priority.
Also added adobe/elixir-styler to CI and made a few minor refactoring changes.







