I am trying to implement the Separate Server setup for hangfire as shown on the hangfire overview page. It shows an app server, a hangfire server and a database server. I’m having trouble wrapping my head around how the app server and hangfire server interact. Does anyone have an example of this setup? Should hangfire exist as a service on it’s own server?
I am using SQL server and MSMQ.
Thanks
Okay so you’re trying to implement this setup ?
So in this the application server is creating the jobs and adding them to the queue, the backend server is processing the queued jobs and the application server is probably hosting the dashboard. (It doesn’t matter which server hosts the dashboard) Let’s say the database server is hosting both SQL Server and the MSMQ. (You may have multiple application servers and multiple backend servers, it doesn’t make a difference to the setup)
All of the interaction is done through the database server. When an application server creates a job, it is added to the MSMQ (Background job) or to SQL Server (Recurring Job). The backend servers pick up jobs from these and perform the processing, writing the status back into SQL Server. The dashboard running on the application servers monitor SQL Server so that it can display the status of the jobs.
Which scenario you use depends on the task you’re trying to perform and your performance / fault-tolerance constraints.
That’s perfect thanks, very clear explanation. I got this working with a console application on the Hangfire Server but can’t get it to work with a windows service, I created a new topic about that here Hangfire Service Setup if you have any insight into that.