Release Notes
The goal of this release is to incorporate important changes from recent versions 1.6.18, 1.6.19 and 1.6.20, as well as provide great improvements for Hangfire.SqlServer unlocked by schema changes introduced in 1.7.0:
- Blocking fetch. It is possible now to avoid polling when using SQL Server. Short-lived (2 seconds) application locks are used to implement this behavior, and workers don't compete now with each other and don't perform unnecessary concurrent logical reads when queue is empty. The only requirement is to use sliding-expiration-based fetch as shown below.
- Less CPU-consuming fetch when using sliding expiration-based fetch. When using table as a queue, the major CPU consumption is done for scanning ghost rows, since SQL Server deletes records asynchronously. Now page locks are acquired to force SQL Server to remove them in-place, instead of postponing this action. It's essential to minimize the lifetime of these locks, so improvement works only for sliding-expiration fetch method.
- Improved parallelism for hashes, sets and lists. Instead of acquiring global, coarse-grained application locks, we now using regular SQL Server's locks. To avoid deadlocks, we are reordering writes in transactions to match clustered key sorting.
To use all the new features, consider adding the following lines to your configuration logic:
GlobalConfiguration.Configuration
.UseSqlServerStorage(@"connection_string", new SqlServerStorageOptions
{
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), // To enable Sliding invisibility fetching
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5), // To enable command pipelining
QueuePollInterval = TimeSpan.FromTicks(1) // To reduce processing delays to minimum
})
Hangfire.Core
- Fixed –
MissingMethodException
when using Newtonsoft.Json 11 in .NET Core 2.X with continuations (by @pieceofsummer). - Ported – Merged updates from versions 1.6.18 – 1.6.20.
Hangfire.SqlServer
- Added – Blocking fetch support for sliding expiration-based fetch to avoid excessive polling.
- Changed – Optimize sliding-expiration-based fetching to use even less CPU time.
- Changed – Use write reordering and fine-grained locking scheme to improve parallelism.
- Ported – Merged updates from versions 1.6.18 – 1.6.20.