Need help understanding the worker_pool by inaka - anyone have any simple examples?

hey everyone. i am desperately trying to understand the worker_pool by inaka(GitHub - inaka/worker_pool: Erlang worker pool). the complex examples are quite hard to understand for a beginner like me, does anyone have any simple examples displaying the use of wpool please?


@shalinimada I would rather suggest poolboy or poolgirl. Much simpler to read and use IMHO

@shalinimada welcome! I suppose Mr. @elbrujohalcon can provide a lot of information about this great project.

In a nutshell: The idea behind worker_pool was that you would just replace your calls to gen_server with calls to wpool, i.e., wherever you had a gen_server:call(…) now you put a wpool:call(…) and that’s it!

Here you can find our original explanation in a blog post that was luckily archived at inaka / Worker Pool (for Erlang)


thank you so much., i will try that out

1 Like

I’m not sure if it improved over time, but at the time of creating worker_pool, poolboy had a far more complex interface and it was far less configurable and scalable than wpool.
In fact, we wrote worker_pool because the libraries that existed at the time were insufficient for our purposes.

If I might only ask, can you point out which examples (or a lack of them) did you find complex? Would love to fix documentation a bit so any feedback is welcomed :slight_smile:


In the test folder, in the various test suites there is a lot of information there,especially for a someone can easily get lost.
a simple basic example would have been great . for example :
in worker_pool.erl::
wpool:start_pool(test_pool,…) , that starts a test_worker.erl as a worker n times. and the some lines of code to bounce calls , broadcasts , calls in a simple way to easily understand worker_pool.

I think that would have been very helpful.


Hi @shalinimada, I would love to hear what you are trying to do with pools.

The available options, worker_pool, poolboy, poolgirl, the about-to-be-revived pooler, hnc and maybe more, are each suited to slightly different use cases, AFAICT, but in order to give you better advice I need to know more about your use case.

FWIW, personally I wouldn’t go for poolboy, though. The project seems to be abandoned, it has bugs and ugly edge case scenarios that have been known for ages but were never fixed. As an example, failure to restart a single worker crashes the entire pool.

1 Like

Hey, I’ve reworked a lot the documentation, though currently there’s a conflict between what the formatter’s plugin and the documentation plugin like, so until it is resolved, we can’t merge.

However, you can checkout that branch and build the documentation locally using rebar3 ex_doc and browse the docs as they are generated. Hopefully it’d be more useful now, let me know :slight_smile:

Edit, oh, the PR, forgot to paste!


Look… it’s alive!! Worker Pool — worker_pool v6.2.0