Open Closed

Hangfire setup of Multitenant #10359

jur.porras created


  • What is your product version? 10.0
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .Net Core

We have confirmed that hangfire is automatically chooses instances to our available servers. And is random. There are chances that when hangfire runs it goes to the server instance that has low specifications which cause or web app to break. Simple job which usuually done in a second finished after a several minutes or worst case, hours.

Maybe this is because the queues are stored in the host db? I am not sure if the issue we are experiencing is related to that. But if there's a possiblity setup that each tenant can manage their queues on their respective databases (not host) , hangfire will automatically chooses an instance provided to their app services.

Is there something to do in assigning the connection string? Currently we have this in our Startup file.

services.AddHangfire(config => { config.UseSqlServerStorage(_appConfiguration.GetConnectionString("Default")); ...

Please advise.

Regards, Jur

2 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @jur.porras

    AspNet Zero's Hangfire implementation doesn't support storing jobs on Tenant databases. I think it will not make any difference even if it does.

    Maybe creating a different queue for each Tenant might work for you

  • 0
    jur.porras created

    Hi ismcagdas,

    We experiencing that jobs intended for a tenant is using server instances from the available servers regardless of regions.

    For example:

    Tenant1 has 10 jobs queued in the host db. Host db has many tenants, with different regions (south central & norhcentral). Those 10jobs is randomly selecting server from those tenants app services. Often will select the one's in northcentral, which cause latency issues - very slow.

    I have checked the hangfire "Configuring Job Queues". The docs shows how to prioritize jobs in queue. I think this not applicable to our current situation. PLease advise.

    Looking forward for your response.

    Regards, Jur