Base solution for your next web application
Open Closed

Background worker performance monitoring and database locks #7467


User avatar
0
inzone created

We use Hangfire for our Background Jobs, but as documented, periodic background workers don't use Hangfire.

If I enable Quartz, do I get a dashboard like in Hangfire for my background workers? I need to be able to easily monitor our background workers activity, to diagnose exceptions or performance issues.

We also use Application Insights, but as it's a request based profiler, it doesn't get stats related to background workers.

Also we find that when a background worker is working on a long running process that takes a large dataset from the database, any other non background process can't insert or update to the tables related with that dataset. If I set all Unit Of Work methods associated to the background worker as non transactional, all those tables will be unlocked so I don't get SQL timeouts on regular user activity?


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    If I enable Quartz, do I get a dashboard like in Hangfire for my background workers? I need to be able to easily monitor our background workers activity, to diagnose exceptions or performance issues.

    Hangfire and Quartz are both third-party libraries. Hangfire provides Dashboard functionality, but as far as I know, Quartz does not currently provide Dashboard. Of course, some third-party libraries make Dashboard for Quartz.

    We also use Application Insights, but as it's a request based profiler, it doesn't get stats related to background workers.

    I have not tried it, but I think the request-based profiler should support manual control. For example, for console applications.

    Also we find that when a background worker is working on a long running process that takes a large dataset from the database, any other non background process can't insert or update to the tables related with that dataset. If I set all Unit Of Work methods associated to the background worker as non transactional, all those tables will be unlocked so I don't get SQL timeouts on regular user activity?

    Sql transactions should try to keep it fast, and try to reduce the monopoly of data as much as possible. You should adjust the transaction isolation level based on the actual situation. This also applies to the code of the business logic.