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?
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!
thank you so much., i will try that out
I’m not sure if it improved over time, but at the time of creating
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
In the test folder, in the various test suites there is a lot of information there,especially for a beginner.so someone can easily get lost.
a simple basic example would have been great . for example :
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,
poolgirl, the about-to-be-revived
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.
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
Edit, oh, the PR, forgot to paste!
Look… it’s alive!! Worker Pool — worker_pool v6.2.0