DynaScaleHangfire 1.0.11
See the version list below for details.
dotnet add package DynaScaleHangfire --version 1.0.11
NuGet\Install-Package DynaScaleHangfire -Version 1.0.11
<PackageReference Include="DynaScaleHangfire" Version="1.0.11" />
<PackageVersion Include="DynaScaleHangfire" Version="1.0.11" />
<PackageReference Include="DynaScaleHangfire" />
paket add DynaScaleHangfire --version 1.0.11
#r "nuget: DynaScaleHangfire, 1.0.11"
#:package DynaScaleHangfire@1.0.11
#addin nuget:?package=DynaScaleHangfire&version=1.0.11
#tool nuget:?package=DynaScaleHangfire&version=1.0.11
DynaScaleHangfire
A dynamic scaling extension for Hangfire that provides real-time queue monitoring and automatic server scaling capabilities.
Features
- Real-time Queue Monitoring: Monitor job queue lengths and processing status
- Dynamic Server Scaling: Automatically scale Hangfire servers based on queue load
- RESTful API: Simple HTTP endpoints for queue management
- Web Dashboard Integration: Seamless integration with Hangfire dashboard
- Configurable Scaling Rules: Customizable thresholds and scaling policies
- Health Monitoring: Built-in health checks and status reporting
Installation
NuGet Package
dotnet add package DynaScaleHangfire
Manual Installation
- Clone this repository
- Build the project
- Reference the built assembly in your project
Quick Start
1. Add Services
using Hangfire.DynaScale.Extensions;
using Hangfire.DynaScale.Models;
var builder = WebApplication.CreateBuilder(args);
// Add DynaScale services
builder.Services.AddHangfireDynaScale(new HangfireSettings
{
MinWorkerCount = 1,
MaxWorkerCount = 10,
ScaleUpThreshold = 5,
ScaleDownThreshold = 2,
CheckIntervalSeconds = 30
});
2. Configure Middleware
Option A: Automatic Setup (Recommended)
var app = builder.Build();
// Automatically creates wwwroot directory and adds static files middleware
app.UseHangfireDynaScaleWithStaticFiles();
Option B: Manual Setup
var app = builder.Build();
// Add static files middleware manually
app.UseStaticFiles();
// Add DynaScale routes
app.UseHangfireDynaScale();
3. Access Dashboard
Navigate to /dynamic-scaling
to access the DynaScale dashboard.
Configuration
The HangfireSettings
class allows you to configure:
MinWorkerCount
: Minimum number of worker processesMaxWorkerCount
: Maximum number of worker processesScaleUpThreshold
: Queue length threshold to trigger scale upScaleDownThreshold
: Queue length threshold to trigger scale downCheckIntervalSeconds
: How often to check queue status
How It Works
DynaScaleHangfire monitors your Hangfire job queues in real-time and automatically scales the number of worker processes based on the configured thresholds. When the queue length exceeds the scale-up threshold, it increases the worker count. When the queue length falls below the scale-down threshold, it decreases the worker count.
The web dashboard provides real-time monitoring of:
- Current queue lengths
- Active worker count
- Scaling history
- System performance metrics
Automatic wwwroot Creation
This package automatically creates a wwwroot
directory in your project if it doesn't exist when using UseHangfireDynaScaleWithStaticFiles()
. This ensures that Hangfire's dashboard static files are properly served.
Project Structure
DynaScaleHangfire/
├── Controllers/
│ └── DynaScaleController.cs # REST API endpoints
├── Extensions/
│ ├── ApplicationBuilderExtensions.cs # Middleware configuration
│ └── ServiceCollectionExtensions.cs # DI configuration
├── Models/
│ └── HangfireSettings.cs # Configuration models
├── Services/
│ ├── HangfireServerManager.cs # Core scaling logic
│ └── IHangfireServerManager.cs # Service interface
└── wwwroot/
└── js/
└── dynamic-scaling.js # Frontend JavaScript
Configuration Options
Setting | Type | Default | Description |
---|---|---|---|
MinWorkerCount | int | 1 | Minimum number of worker servers |
MaxWorkerCount | int | 10 | Maximum number of worker servers |
ScaleUpThreshold | int | 100 | Queue length threshold for scaling up |
ScaleDownThreshold | int | 10 | Queue length threshold for scaling down |
CheckIntervalSeconds | int | 30 | Interval between scaling checks |
Development
Prerequisites
- .NET 7.0 SDK or later
- Visual Studio 2022 or VS Code
- SQL Server (for Hangfire storage)
Building
dotnet restore
dotnet build
dotnet test
Testing
dotnet test
Creating NuGet Package
dotnet pack -c Release
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
- Project Link: https://github.com/yourusername/DynaScaleHangfire
- Issues: https://github.com/yourusername/DynaScaleHangfire/issues
Acknowledgments
- Built on top of Hangfire
- Inspired by modern microservices scaling patterns
- Community contributions and feedback
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Hangfire.Core (>= 1.8.6)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
1.0.36 | 89 | 7/4/2025 | |
1.0.35 | 94 | 7/4/2025 | |
1.0.34 | 89 | 7/4/2025 | |
1.0.33 | 93 | 7/4/2025 | |
1.0.32 | 106 | 7/4/2025 | |
1.0.31 | 123 | 7/4/2025 | |
1.0.30 | 115 | 7/4/2025 | |
1.0.29 | 142 | 7/3/2025 | |
1.0.28 | 126 | 7/3/2025 | |
1.0.27 | 135 | 7/3/2025 | |
1.0.26 | 125 | 7/3/2025 | |
1.0.25 | 129 | 7/3/2025 | |
1.0.24 | 132 | 7/3/2025 | |
1.0.23 | 134 | 7/3/2025 | |
1.0.22 | 126 | 7/3/2025 | |
1.0.21 | 142 | 6/30/2025 | |
1.0.20 | 128 | 6/30/2025 | |
1.0.19 | 123 | 6/30/2025 | |
1.0.18 | 121 | 6/30/2025 | |
1.0.17 | 126 | 6/30/2025 | |
1.0.16 | 125 | 6/30/2025 | |
1.0.15 | 204 | 6/30/2025 | |
1.0.14 | 202 | 6/30/2025 | |
1.0.13 | 205 | 6/30/2025 | |
1.0.12 | 205 | 6/30/2025 | |
1.0.11 | 206 | 6/30/2025 | |
1.0.10 | 208 | 6/30/2025 | |
1.0.9 | 176 | 6/27/2025 | |
1.0.8 | 117 | 6/27/2025 | |
1.0.7 | 123 | 6/27/2025 | |
1.0.6 | 124 | 6/27/2025 | |
1.0.4 | 162 | 6/27/2025 | |
1.0.3 | 174 | 6/26/2025 | |
1.0.2 | 288 | 6/26/2025 |