No video

Scaling HANGFIRE: Processing More Jobs Concurrently

  Рет қаралды 13,611

CodeOpinion

CodeOpinion

Күн бұрын

Пікірлер: 41
@CodeOpinion
@CodeOpinion 3 жыл бұрын
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.
@maxkatz4254
@maxkatz4254 3 жыл бұрын
Thanks for the video! I have used Hangfire for delayed push notifications and for synchronizing two databases (NoSQL read-only and SQL for for write-read).
@allannielsen4752
@allannielsen4752 3 жыл бұрын
Runs the reporting engine.
@alexprift2242
@alexprift2242 3 жыл бұрын
As always a good video with great content. Thanx Derek!
@CodeOpinion
@CodeOpinion 3 жыл бұрын
Much appreciated!
@gabrieliws
@gabrieliws 2 жыл бұрын
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 😀
@CodeOpinion
@CodeOpinion 2 жыл бұрын
1-I haven't used quartz 2-not that I'm aware of. Maybe there is an extension? 3-Depends if your using different job storage, that's per dashboard.if each container has its own job storage then yes, dashboard per. 4-yes! If you change a signature of a job, it will break calling the job. You need to be backwards compatible for the existing job to run.
@rajkumarks4443
@rajkumarks4443 8 ай бұрын
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?
@CodeOpinion
@CodeOpinion 8 ай бұрын
A job will only run on one worker at a time. It handles concurrency for you.
@malikbrahimi7504
@malikbrahimi7504 Жыл бұрын
How does this compare to ResourceStack jobs on AKS?
@sarathbaiju6040
@sarathbaiju6040 Жыл бұрын
Hi, Is helper method available in hangfire library to get all the running job instances?
@JoseVargas-dx7wz
@JoseVargas-dx7wz 2 жыл бұрын
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?
@joymonscode
@joymonscode Жыл бұрын
Did you find any answer to this? I am considering HF for queuing jobs that must be processed only once.
@asifshahzad7547
@asifshahzad7547 Жыл бұрын
Hi @CodeOpinion can you please share about how we can achieve DI in Hangfire for complex data types
@asifshahzad7547
@asifshahzad7547 Жыл бұрын
@codeOpinion
@CodeOpinion
@CodeOpinion Жыл бұрын
Hangfire Docs: docs.hangfire.io/en/latest/background-methods/passing-dependencies.html
@shreyasmahajan2157
@shreyasmahajan2157 Жыл бұрын
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.
@CodeOpinion
@CodeOpinion Жыл бұрын
Combination of both possibly. Ultimately how many threads you have per hangfire service is based on how much work (memory/cpu) is involved in processing the job/email.
@shreyasmahajan2157
@shreyasmahajan2157 Жыл бұрын
@@CodeOpinion Thanks a lot. Will try with Worker Threads first.
@reminvestor
@reminvestor 2 жыл бұрын
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.
@CodeOpinion
@CodeOpinion 2 жыл бұрын
If you're using MS DI, there is extension methods to configure server or just the client.
@nqaiser
@nqaiser Жыл бұрын
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?
@CodeOpinion
@CodeOpinion Жыл бұрын
Locks. Depends on the job storage but regardless locking.
@fevziozgul6780
@fevziozgul6780 Жыл бұрын
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?
@CodeOpinion
@CodeOpinion Жыл бұрын
Yes, any downstream services, including database can be affected by scaling out more hangfire servers. In order to avoid a never ending backlog in the queue, you have to either have to scale all the downstream services affected which means process more messages or slow the rate down of messages are produced into the queue. Check out this video: kzbin.info/www/bejne/eHqqmn-Af9F4Zpo
@thedacian123
@thedacian123 2 жыл бұрын
I think,i ve spotted here concurent consumer patther wit hangfire source acting as a message broker.Is this correct?
@CodeOpinion
@CodeOpinion 2 жыл бұрын
Yes, competing consumers.
@anitin3
@anitin3 3 жыл бұрын
Hi Derek in your opinion which SPA Frontend framework is more popular in working with .net core apps ReactJS, Angular or Vue?
@CodeOpinion
@CodeOpinion 3 жыл бұрын
I'm not entirely sure what's the most popular one. I posted a poll on Twitter: twitter.com/codeopinion/status/1316820854731427841
@CodeOpinion
@CodeOpinion 3 жыл бұрын
This poll got a decent amount of votes. Remember this is what people are using, not what they necessarily want to use. Or at least that's how I intended it as being worded in the poll.
@anitin3
@anitin3 3 жыл бұрын
@@CodeOpinion thanks Derek.It was helpful i will start learning react.
@sureshhalade
@sureshhalade 3 жыл бұрын
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
@sureshhalade 3 жыл бұрын
Look like we can do something like this: var options = new BackgroundJobServerOptions { WorkerCount = Environment.ProcessorCount * 5 }; app.UseHangfireServer(options); However how do we do all this at runtime to scale out and scale in back ? Any inputs? thanks.
@CodeOpinion
@CodeOpinion 3 жыл бұрын
To increase the WorkerCount at runtime after it has already been started?
@sureshhfreelance3917
@sureshhfreelance3917 3 жыл бұрын
@@CodeOpinion yes
@CodeOpinion
@CodeOpinion 3 жыл бұрын
@@sureshhfreelance3917 I don't believe you can after startup. At least from what I'm aware of. I'd have to look into Hangfire docs more to see if its possible.
@sureshhfreelance3917
@sureshhfreelance3917 3 жыл бұрын
@@CodeOpinion ok no worries. My understanding is also same. Thanks for response.
@JeffChentingwei628
@JeffChentingwei628 3 жыл бұрын
Is polling the storage inefficient ?
@CodeOpinion
@CodeOpinion 3 жыл бұрын
It's not ideal that's for sure. In my use cases, I want to process jobs quickly as possible, so the latency of the polling time is what concerns me with polling. The Hangfire.Redis.Pro (commercial) solves this by using Redis Pub/Sub so it's not polling and latency is really really low.
@crisu85
@crisu85 3 жыл бұрын
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? :)
@CodeOpinion
@CodeOpinion 3 жыл бұрын
I currently use a combination of ASP.NET Core Health Checks and using the Hangfire Monitoring API to get the number of active servers, enqueued jobs, etc. Then I alarm based on those metrics.
C# ASP.NET Core 5 | Hangfire
24:30
codaza
Рет қаралды 10 М.
Hangfire + MediatR = Message Dispatcher
10:56
CodeOpinion
Рет қаралды 21 М.
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 15 МЛН
Cute kitty gadgets 💛
00:24
TheSoul Music Family
Рет қаралды 10 МЛН
123 GO! Houseによる偽の舌ドッキリ 😂👅
00:20
123 GO! HOUSE Japanese
Рет қаралды 6 МЛН
What will he say ? 😱 #smarthome #cleaning #homecleaning #gadgets
01:00
Keep your project structure simple!
15:08
CodeOpinion
Рет қаралды 17 М.
Where should you use gRPC? And where NOT to use it!
10:57
CodeOpinion
Рет қаралды 81 М.
Message Queue Overload! Avoiding Processing Latency
6:58
CodeOpinion
Рет қаралды 3,6 М.
Brutally honest advice for new .NET Web Developers
7:19
Ed Andersen
Рет қаралды 152 М.
Hangfire - Hangfire in .Net Core | Hangfire Asp.Net Core
16:17
Coding Droplets
Рет қаралды 23 М.
Vertical Slice Architecture isn't technical
8:19
CodeOpinion
Рет қаралды 5 М.
.NET 6 Startup Changes - Handling Program.cs Without Startup.cs
26:23
CQRS Myths | 3 Most Common Misconceptions
6:51
CodeOpinion
Рет қаралды 20 М.
Do NOT Learn Kubernetes Without Knowing These Concepts...
13:01
Travis Media
Рет қаралды 273 М.
Containers vs VMs: What's the difference?
8:08
IBM Technology
Рет қаралды 755 М.
WILL IT BURST?
00:31
Natan por Aí
Рет қаралды 15 МЛН