I use Gearman entirely as a point to introduce asynchronous-ness in my application. There is a complicated and image-heavy PDF to generate and this happens on an automated schedule. To do this, I use the GearmanClient::doBackground method. This inserts a priority 1 job into my queue.
Using the doHighBackground()
and the doLowBackground()
methods insert jobs into the queue and checking out my persistent storage I see that the priorities work like this:
priority | method | 0 | doHighBackground() |
1 | doBackground() |
2 | doLowBackground() |
---|
Gearman works out which task is the next highest priority and will hand it to the next available worker – which means that I can set my automated reporting lower priority than the reports requested by real live people wanting them now, and everyone is happy!