worker_pool
worker_pool
Allocates a fixed pool of fibers for performing work. This reduces the overhead of allocating stacks and helps limit memory usage.
Installation
-
Add the dependency to your
shard.yml
:dependencies: worker_pool: github: spider-gazelle/worker_pool
-
Run
shards install
Usage
require "worker_pool"
pool = WorkerPool.new(100)
10_000.times do
pool.perform { my_task }
end
Contributing
- Fork it (https://github.com/spider-gazelle/worker_pool/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Stephen von Takach - creator and maintainer