worker_pool
Version, currently main branch1 version
- main branchlatestJun 17, 2025
github.com/anaPerezGhiglia/worker_pool
Minimalistic worker pool implementation to split workload between concurrent workers in a bounded manner
Installation
# Add this to your shard.yml
dependencies:
worker_pool:
github: anaPerezGhiglia/worker_pool
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.16.3- License
- MIT
- Author
- Ana Perez Ghiglia
Dependencies
This version declares no dependencies.
README
worker_pool
Minimalistic worker pool implementation
WorkerPool allows to split workload between concurrent workers in a bounded manner (it spawns a new fiber for each worker created)
Installation
-
Add the dependency to your
shard.yml:dependencies: worker_pool: github: anaperezghiglia/worker_pool -
Run
shards install
Usage
Keep in mind that the pool is internally implemented with a BufferedChannel. This means that if the channel is full then the calling fiber will block until there is space for the new workload. The size of the buffer and the number of active workers is configurable so it can fit different needs.
buffer_capacitydefines the capacity of the inner Channel.pool_sizecontrols the # of workers (thus fibers) to initialize & have ready to process workload
instantiate a new worker_pool
require "worker_pool"
worker_pool = WorkerPool::Pool(String).new buffer_capacity: 10, pool_size: 3 { |channel, id|
Mailman.new(channel, id)
}
process workload
worker_pool.process("This is an example")
Explore examples directory for more detailed examples
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/your-github-user/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
- Ana Perez Ghiglia - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Jun 17, 2025
- Crystal
>= 1.16.3- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/anaPerezGhiglia/worker_pool
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 17, 2026
- Synced
- Aug 17, 2026
- Versions
- 1