C
C#4mo ago
Core

✅ Background jobs, choosing the right library

Hello, I need to implement a scheduled job that will be periodically executed. Why are there so many libraries: Hangfire, Quartz, Coravel? Even .NET offeres the BackgroundService out of the box. How do I choose the right library? Literally every one of them gets the job done...
10 Replies
Pobiega
Pobiega4mo ago
They all have their own tradeoffs. Is it a one off, or do you have multiple jobs? What about multiple worker instances?
Core
CoreOP4mo ago
I would have multiple jobs, not just one. But each one would query the DB
Pobiega
Pobiega4mo ago
Okay. What about an admin panel to run jobs manually etc? Is that something you need, or not relevant And the amount of running instances question is still important Ie, if you have three running instances, would it be a problem if all three ran the job?
Core
CoreOP4mo ago
I was thinking of usign distributed locking mechanism, so the task wouldn't be executed by multiple instances
Pobiega
Pobiega4mo ago
That works. Otherwise, hangfire and quartz have that built in if wanted I'd probably recommend go with coravel if you don't need manual triggering
Core
CoreOP4mo ago
Sorry, I forgot to mention that part, no GUI is needed, everything should be executed programmatically Thank you
Pobiega
Pobiega4mo ago
There is an important caveat thou, coravel defaults to UTC If you want to specify scheduled times in local TZ, don't forget to apply that modifier
Core
CoreOP4mo ago
I'm using Utc both in DB, and application
Pobiega
Pobiega4mo ago
Ok, np then
Core
CoreOP4mo ago
Thanks again

Did you find this page helpful?