ZeroAlloc.Scheduling
2.2.11
dotnet add package ZeroAlloc.Scheduling --version 2.2.11
NuGet\Install-Package ZeroAlloc.Scheduling -Version 2.2.11
<PackageReference Include="ZeroAlloc.Scheduling" Version="2.2.11" />
<PackageVersion Include="ZeroAlloc.Scheduling" Version="2.2.11" />
<PackageReference Include="ZeroAlloc.Scheduling" />
paket add ZeroAlloc.Scheduling --version 2.2.11
#r "nuget: ZeroAlloc.Scheduling, 2.2.11"
#:package ZeroAlloc.Scheduling@2.2.11
#addin nuget:?package=ZeroAlloc.Scheduling&version=2.2.11
#tool nuget:?package=ZeroAlloc.Scheduling&version=2.2.11
ZeroAlloc.Scheduling
Source-generated background jobs for .NET: mark a class with [Job] and get one-off, delayed and cron jobs with retries, durable stores and a dashboard, with no runtime registration cost and NativeAOT support.
Why ZeroAlloc.Scheduling
- No runtime registration cost.
[Job]registration is generated at compile time. Coravel'sSchedule()allocates 696 B per call, measured in the same run. - Dispatch costs what a hand-written timer costs. BenchmarkDotNet cannot tell a ZA.Scheduling dispatch from an empty method, just as it can't for a direct call. A test asserts the worker allocates nothing per job beyond the
JobContextit hands to the job. - Works under NativeAOT and trimming. Executors and DI registration are generated, with no reflection or assembly scanning. CI publishes and runs an AOT app over the in-memory, ORM and Redis stores and the Mediator, Resilience and Telemetry bridges.
- Compile-time diagnostics. The generator flags jobs it cannot register, such as nested or generic job types or two jobs that would get the same registration method.
Install
dotnet add package ZeroAlloc.Scheduling
dotnet add package ZeroAlloc.Scheduling.InMemory
The source generator ships inside ZeroAlloc.Scheduling. Swap the in-memory store for EF Core, ZeroAlloc.ORM or Redis in production.
Quick start
using System.Text.Json.Serialization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ZeroAlloc.Scheduling;
using ZeroAlloc.Scheduling.InMemory;
using ZeroAlloc.Serialisation;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddSerializerDispatcher(); // generated, AOT-safe job serializer
builder.Services.AddScheduling(o => o.PollingInterval = TimeSpan.FromMilliseconds(100))
.WithInMemoryStore() // or EfCore, Orm or Redis in production
.AddSendWelcomeEmailJob(); // generated for the [Job] class
using var host = builder.Build();
await host.StartAsync();
var scheduler = host.Services.GetRequiredService<IScheduler>();
await scheduler.EnqueueAsync(new SendWelcomeEmailJob { To = "alice@example.com" });
await Task.Delay(500); // the worker picks it up, with retries if it throws
await host.StopAsync();
[Job(MaxAttempts = 5)]
[ZeroAllocSerializable(SerializationFormat.SystemTextJson)]
public sealed class SendWelcomeEmailJob : IJob
{
public required string To { get; init; }
public ValueTask ExecuteAsync(JobContext ctx, CancellationToken ct)
{
Console.WriteLine($"Welcome mail to {To}, attempt {ctx.Attempt}");
return ValueTask.CompletedTask;
}
}
[JsonSerializable(typeof(SendWelcomeEmailJob))]
internal sealed partial class AppJson : JsonSerializerContext;
For a recurring job, use [Job(Cron = "0 * * * *")] or [Job(Every = Every.Hour)]: the generator also emits a hosted service that schedules it at startup. The getting started guide covers delays, retries and stores.
What you get
- One-off jobs, delayed jobs and recurring jobs from cron expressions or fixed intervals.
- Exponential-backoff retry per job or globally, then dead-lettering.
- A background worker that polls the store in batches and runs each job through its generated executor.
- Targets .NET 8, 9 and 10.
Stores and integrations:
ZeroAlloc.Scheduling.InMemory: in-process store for development and tests.ZeroAlloc.Scheduling.EfCore: EF Core store on SQL Server, PostgreSQL or SQLite.ZeroAlloc.Scheduling.Orm: ZeroAlloc.ORM store on SQLite, PostgreSQL or SQL Server,WithOrm(), net10.0 only.ZeroAlloc.Scheduling.Redis: Redis store for distributed deployments.ZeroAlloc.Scheduling.Mediator: run a job through ZeroAlloc.Mediator and its pipeline behaviors.ZeroAlloc.Scheduling.Resilience: retry, timeout and circuit-breaker around job execution.ZeroAlloc.Scheduling.Telemetry: OpenTelemetry spans and metrics per job execution.ZeroAlloc.Scheduling.Dashboard: web dashboard with job states, requeue and delete, viaapp.MapJobsDashboard("/jobs"). Put it behind authorization.ZeroAlloc.Scheduling.Dashboard.Blazor: the dashboard as a<JobsDashboard>Blazor component.

Performance
Against Coravel 6.0.2 and a hand-rolled BackgroundService + Timer. BenchmarkDotNet 0.15.8, .NET 10.0.13, measured 2026-10-15. Allocations are exact; speed is a same-run ratio, because the benchmark host is a shared VM.
| Operation | Coravel | Hand-rolled Timer | ZA.Scheduling |
|---|---|---|---|
| Register one job | 696 B per Schedule() call |
— | none at runtime, generated at compile time |
| Register 100 jobs | 76,320 B, 15.36× the time of one call | — | none at runtime |
| Single dispatch | — | indistinguishable from an empty method | indistinguishable from an empty method |
What you pay for is [Job] itself: declarative retries, cron and store-backed persistence, not dispatch speed. Full methodology: docs/performance.md.
Learn more
- Documentation: scheduling.zeroalloc.net
- Reference: source generator, diagnostics, features and packages
- Upgrading: migrating to v2
- Related: ZeroAlloc.Outbox, ZeroAlloc.Mediator, ZeroAlloc.Resilience, ZeroAlloc.Telemetry
- Contributing: issues and pull requests are welcome on GitHub
- License: MIT, see LICENSE
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 is compatible. 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. |
-
net10.0
- Cronos (>= 0.13.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- ZeroAlloc.Resilience (>= 3.3.3)
- ZeroAlloc.Serialisation (>= 2.8.2)
- ZeroAlloc.StateMachine (>= 1.6.3)
- ZeroAlloc.ValueObjects (>= 2.2.2)
-
net8.0
- Cronos (>= 0.13.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- ZeroAlloc.Resilience (>= 3.3.3)
- ZeroAlloc.Serialisation (>= 2.8.2)
- ZeroAlloc.StateMachine (>= 1.6.3)
- ZeroAlloc.ValueObjects (>= 2.2.2)
-
net9.0
- Cronos (>= 0.13.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- ZeroAlloc.Resilience (>= 3.3.3)
- ZeroAlloc.Serialisation (>= 2.8.2)
- ZeroAlloc.StateMachine (>= 1.6.3)
- ZeroAlloc.ValueObjects (>= 2.2.2)
NuGet packages (9)
Showing the top 5 NuGet packages that depend on ZeroAlloc.Scheduling:
| Package | Downloads |
|---|---|
|
ZeroAlloc.Scheduling.EfCore
EF Core job store adapter for ZeroAlloc.Scheduling. |
|
|
ZeroAlloc.Scheduling.Redis
Redis job store adapter for ZeroAlloc.Scheduling. |
|
|
ZeroAlloc.Scheduling.InMemory
In-memory job store for ZeroAlloc.Scheduling — use in tests. |
|
|
ZeroAlloc.Scheduling.Dashboard
Minimal API dashboard for ZeroAlloc.Scheduling — JSON endpoints + embedded HTML/JS UI. |
|
|
ZeroAlloc.Scheduling.Mediator
ZeroAlloc.Mediator bridge for ZeroAlloc.Scheduling — dispatches jobs via IMediator.Send. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.2.11 | 0 | 10/16/2026 |
| 2.2.10 | 29 | 10/15/2026 |
| 2.2.9 | 254 | 10/12/2026 |
| 2.2.8 | 217 | 10/12/2026 |
| 2.2.7 | 238 | 10/11/2026 |
| 2.2.6 | 287 | 10/11/2026 |
| 2.2.5 | 241 | 10/11/2026 |
| 2.2.4 | 228 | 10/11/2026 |
| 2.2.3 | 218 | 10/11/2026 |
| 2.2.2 | 219 | 10/10/2026 |
| 2.2.1 | 230 | 10/10/2026 |
| 2.2.0 | 232 | 10/10/2026 |
| 2.1.0 | 243 | 10/10/2026 |
| 2.0.17 | 221 | 10/10/2026 |
| 2.0.15 | 225 | 10/9/2026 |
| 2.0.14 | 216 | 10/7/2026 |
| 2.0.13 | 227 | 10/7/2026 |
| 2.0.12 | 221 | 10/6/2026 |
| 2.0.11 | 223 | 10/4/2026 |
| 2.0.10 | 224 | 10/3/2026 |