-
Notifications
You must be signed in to change notification settings - Fork 229
Ent Throttling
Faktory Enterprise allows you to throttle the rate jobs are fetched from a given queue.
- Let's say you have a "heavy" image processing job which can overwhelm a server if you process more than 4 at a time. With Faktory, there is no way to limit job dispatch. You could implement distributed locks within your application code but that's a daunting task for many.
- You have a
bulk
queue for low priority work but don't want a huge mass of bulk jobs to take every processing thread available, delaying the fetch ofcritical
jobs. You can limit each worker to only process 5 bulk jobs at a time.
Queue throttling is declared within conf.d/throttles.toml
:
[throttles]
"image-processing" = { concurrency = 4, timeout = 30 }
another_queue = { worker = 1, timeout = 5 }
You declare the queue name and the set of properties for its associated throttle.
There are two throttling algorithms today:
- Concurrency - process up to N jobs concurrently across your entire Faktory worker cluster
- Worker - process up to N jobs per worker across your entire Faktory worker cluster
Reminder: a worker is a process which fetches jobs from Faktory. You might have M worker processes per machine.
Throttles require locks to be taken during FETCH and released upon ACK or FAIL. If a worker process crashes, any locks held on its behalf are effectively orphaned. To handle this case, all throttles must have a timeout, after which a lock expires.
The Faktory Web UI contains a Throttles tab which shows each currently declared throttle and associated runtime usage metrics.
Home | Installation | Getting Started Ruby | Job Errors | FAQ | Related Projects
This wiki is tracked by git and publicly editable. You are welcome to fix errors and typos. Any defacing or vandalism of content will result in your changes being reverted and you being blocked.