Scaling HANGFIRE: Processing More Jobs Concurrently

preview_player
Показать описание
Scaling Hangfire can be done in two ways: Increase the number of worker threads per server, or increase the number of servers. You also need to be aware of the constrains of the underlying host. That could be a Docker, VM, or a Physical Host. Regardless, there are constraints of CPU and memory that you will likley need to look at to determine the right number of worker threads per hangfire server. You can scale out further by deploying many hangfire servers on different underlying hosts. Tip: Be aware of moving the bottleneck and be sure that downstream services can handle the extra load.

💥 Join this channel to get access to source code & demos!

🔥 Don't have the JOIN button? Support me on Patreon!

0:00 Intro to Producers & Consumers
1:39 Worker Threads
3:35 Multiple Hangfire Servers
5:05 Downstream Services

#hangfire #dotnet #backgroundjobs
Рекомендации по теме
Комментарии
Автор

Are you using Hangfire? Let me know in the comments what specifically for. If you have any questions about how to implement something with Hangfire, Let me know in the comments and I'll try and tackle it in another video.

CodeOpinion
Автор

Hi,
Is helper method available in hangfire library to get all the running job instances?

sarathbaiju
Автор

We're using Hangfire background scheduler in our .NET 6 Web API. As we're planning to host this app across multiple servers for load balancing, and these servers share a single database, are there any possibilities of job failures or dupes or running multiple times? Are there specific configurations like different schemas or queues that could help prevent such issues?

rajkumarks
Автор

How does this compare to ResourceStack jobs on AKS?

malikbrahimi
Автор

Nice video, Derek !
I have been learning Hangfire and Quartz for the past few days.
Imo HF is much easier to understand than Quartz.
I have some questions, appreciate if you could give some info :)

1. What’s you thought on Quartz?
2. I also tried the HF dashboard, it is good but I wonder how to find a certain job based on recurring job id, since no filter in the UI. I feel it will be very difficult if I have massive number of jobs in production.
3. I plan to use multiple containers for HF servers and a single container for dashboard. I could think of hundreds/thousands of containers for the servers with multiple queues, do you think HF would be able to handle it?
4. I noticed HF persist the method name and arguments, so if we change the method structure it will be a breaking change and the existing jobs won’t be able to be executed. Do you have any tips on this matter?

Apologise for the long questions. Thank you in advance 😀

gabrieliws
Автор

If you happen to have multiple servers that can take work(e.g send an email to someone), how does hangfire ensure that no more than one server would execute the same job?

nqaiser
Автор

Hi, from the documentation I understood exactly what you showed in the video as ways to scaling the amount of jobs processed, but as soon as I'm setting the number of workers to more than 1, I experience that enqueued jobs are ran more than once. As if more than one thread is taking the same record from the list of enqueued jobs.
I use HF 1.7.3 and mySQL local storage.

Any toughts?

JoseVargas-dxwz
Автор

Whatever you do with the hangfire scaling, if you have too many hangfire jobs running that put load on the main database, you will have bottlenecks and hangfire scaling will not help. What can one do in such situations?

fevziozgul
Автор

Can you explain the configuration difference between the application that is enqueuing the jobs vs the application that is running the hangfire server? From what I can tell you just don't start the server on the one that is enqueuing.

reminvestor
Автор

As always a good video with great content. Thanx Derek!

alexprift
Автор

Thanks a lot for the helpful video. I just wanted to ask a thing : I am planning to send around 2000 emails at once. What would be more beneficial : Worker Threads or Multiple Hangfire Servers ? Thanks for your help.

shreyasmahajan
Автор

Hi @CodeOpinion can you please share about how we can achieve DI in Hangfire for complex data types

asifshahzad
Автор

Nice video :) I'm also using HF to separate image processing from the main application (and scale by the number of servers). I'm wondering how you would approach to monitor HF servers? For example, my HF server just got killed by some exception or any other error (whole machine down). Would you do that by setting a watchdog on a different server or maybe any other clever solution? :)

crisu
Автор

I think, i ve spotted here concurent consumer patther wit hangfire source acting as a message broker.Is this correct?

thedacian
Автор

Hi Derek in your opinion which SPA Frontend framework is more popular in working with .net core apps ReactJS, Angular or Vue?

anitin
Автор

Hi, Nice video. I am exploring this option and don't find any params that AddHangfireServer accepts. Is it tagged to any specific version of Hangfire ? Additionally, can we add additional worker threads and/or servers at runtime? And you did not show any code to add additional servers, can it be configurable?
Thanks.

sureshhalade
visit shbcf.ru