Got tired to aim and click the Retry button on each failed job? It is much easier now, look at this:
Never knew that animated GIF optmimzation is so boring, especially for the first time.
You are also able to select all jobs in one click. Many thanks to GitHub Issues – they gave me an idea of how to make an ideal implementation of multiple items selection.
When you write the code, it is important to have an instrument to measure the performance time. ASP.NET has different diagnostic tools for this task – Glimpse, MiniProfiler and other useful ones. But they are aimed to provide information about requests only, and almost useless for background jobs – they are executed outside of a request.
I’ve implemented simple diagnostic feature (and not the replacement to full-stack performance profilers, such as dotTrace) for Hangfire Monitor, and now you are able to see the following timings in Hangfire Monitor:
- Duration – job method + all filters performance time.
- Latency – delay between the job creation and method invocation. This metric shows you background job invocation overhead.
As you can see, you can also watch the delays between state transitions. All timings have minimum resolution in 1 second. This resolution caused by using unix timestamps in Hangfire. We need to change the things, but a bit later.
These metrics are added to the
SucceededState, so they are also available to state filters.
This filter places a distributed lock in the beginning of a method performance and releases it after it was completed using the
IServerFilter interface. The type and method name are used as a locking resource. Each storage uses its own distributed lock implementation:
- SQL Server uses
- Redis implementation uses the technique described in its documentation.
The filter is very useful in situations when you are accessing/changing shared resources that does not provide built-in locking routines. Otherwise you should make argumentative decision between using locking system provided by the resource itself, and a custom distributed locking like this filter.
For example, in SQL Server it is better to consider using different isolation levels and table hints first.
- Added - Batch operations on jobs for Hangfire Monitor.
- Added - Retry and delete buttons for almost every page of Hangfire Monitor.
- Added - Duration and latency metrics for succeeded jobs.
- Added - Display state transition latencies on job details page.
- Added - DisableConcurrentExecution filter.
- Misc - Tables in Hangfire Monitor received some love.