Orleans.Lattice.Scaling
This page documents Orleans.Lattice.Scaling 10.5.0, in the documentation for Orleans.Lattice 10.5.0 (release line 10.5), built 2026-12-05. It is also published as markdown, with every table and list, at README.md, and llms.txt lists every page.What is it?
Opt-in autoscaling signal for Orleans.Lattice: a read-only, cluster-aggregate, two-axis (compute and storage) pressure snapshot that an external autoscaler can scrape to size the silo pool.
The package answers one question - how many silo replicas does this cluster need right now? - and answers a second, advisory one alongside it - is any WAL storage account hot enough that its partitions should be spread across more accounts? The first drives replica autoscaling on the compute axis; the second is signal-only and never moves a replica.
Orleans clusters that back a B+ tree store scale on two independent axes:
- Compute: grain-activation working set, host CPU and memory, and the write-ahead-log dispatch pipeline. When these run hot the fix is more silos.
- Storage: retained WAL bytes and per-account backend write throughput. When a single storage account tops out, adding silos does not help; the fix is to spread WAL partitions across more accounts.
A generic CPU-based autoscaler conflates the two and either over-provisions
compute to relieve a storage bottleneck or ignores a genuine compute shortfall.
Orleans.Lattice.Scaling separates them: it publishes a single compute-axis
replica-demand scalar that an external autoscaler (KEDA, an HPA custom metric,
or an Azure Container Apps custom scale rule) consumes directly, and it reports
storage-axis pressure as an operator recommendation that maps onto the
ILatticeAdmin WAL-move workflow.
Core Properties
- Compute axis (
ComputePressure) - normalised activation, host-resource, and WAL-dispatch pressure (each0.0idle to1.0saturated), plus the worst-caseWalSaturationStatethe answering silo has observed across its trees. Activation and resource are the worst silo in the cluster; the WAL-dispatch dimension andWalSaturationare the answering silo's own. The dominant dimension times the current replica count is the raw replica demand. - Storage axis (
StoragePressure) - whether the retained WAL bytes of the trees that declare aWalMaxRetainedBytesceiling reached the configured fraction of those ceilings, the aggregate retained bytes, a per-catalogue-key breakdown (WalAccountPressure) that classifies each account as throughput-bound or capacity-bound, and an optionalWalRebalanceRecommendation.
Both axes roll up into a single ScalingSignal carrying the smoothed,
scale-in-gated ScaleValue (in replica-units) an autoscaler should act on, a
concrete RecommendedReplicas count, the raw RawScaleValue before smoothing,
a human-readable Reason, and a SampledAt timestamp. The storage axis never
contributes to ScaleValue - it is reported for operator action only.
- Read-only and cheap to scrape. A hosted sampler on each silo recomputes
the signal every
SampleIntervaland caches it; every read - the facade, the HTTP endpoint, the health check, or the metrics - returns the cached snapshot and never fans out to the cluster. - Fast to scale out, slow to scale in. A rising demand is adopted
immediately; a falling one decays through an EWMA and only once every
scale-in precondition (all compute dimensions low, WAL healthy, no shard split
in flight) has held for
ScaleInGateWindow. - Off by default. Nothing changes until a host calls
AddLatticeScalingSignal.
Features
| Feature | Description |
|---|---|
| Compute-axis replica demand | ScaleValue and RecommendedReplicas from the dominant compute dimension, smoothed, gated, and floored at MinReplicas. See Architecture. |
| Storage-axis advisory | Per-account throughput-bound versus capacity-bound classification and an optional WalRebalanceRecommendation. See Storage pressure. |
| Split-aware scale-in | Scale-in is held while any shard split is in flight cluster-wide. See split-aware scale-in. |
| HTTP scrape endpoint | MapLatticeScalingSignal serves the signal as JSON with a top-level scaleValue for a KEDA metrics-api scaler. See API. |
| Health check | AddLatticeScalingHealthCheck projects the signal onto a HealthStatus. See Configuration. |
| Metrics and dashboard | Eight observable gauges on the orleans.lattice.scaling meter and a bundled Grafana dashboard. See Observability. |
| Reference autoscaler manifests | An ACA scale rule (JSON and Bicep) and a KEDA ScaledObject, shipped in the package's deploy/ folder. See src/lattice.scaling/deploy/README.md. |
Quick Start
Register the signal on the silo builder, then expose it over an HTTP endpoint on the co-hosted web host (the optional ASP.NET Core health check is covered in Configuration):
using Orleans.Lattice.Scaling;
siloBuilder.AddLatticeScalingSignal(options =>
{
options.MinReplicas = 2;
options.SampleInterval = TimeSpan.FromSeconds(5);
});
using Orleans.Lattice.Scaling;
var app = WebApplication.Create();
// KEDA / ACA scrape target - serves the ScalingSignal as JSON with a top-level
// scaleValue property the autoscaler reads.
app.MapLatticeScalingSignal();
Resolve ILatticeScalingSignal anywhere in the container to read the current
snapshot directly:
using System.Threading;
using Orleans.Lattice.Scaling;
async Task InspectAsync(ILatticeScalingSignal signal, CancellationToken cancellationToken)
{
ScalingSignal current = await signal.GetScalingSignalAsync(cancellationToken);
Console.WriteLine($"scaleValue={current.ScaleValue} replicas={current.RecommendedReplicas} reason={current.Reason}");
}
Reference
| Document | What it covers |
|---|---|
| Architecture | Collectors, aggregation, EWMA smoothing, asymmetric scale-in gating, cluster-aggregate answering, and the storage-axis-never-scales-replicas invariant. |
| Configuration | Every LatticeScalingSignalOptions and LatticeScalingHealthCheckOptions knob, its default, and guidance. |
| API | ILatticeScalingSignal, the snapshot DTOs, and the registration and endpoint extension methods. |
| KEDA on Azure Container Apps | End-to-end ACA walkthrough: the metrics-api custom scale rule, targetValue, min/max replicas, and polling versus EWMA. |
| KEDA and HPA on AKS | A KEDA ScaledObject and the HPA custom-metric alternative on Kubernetes. |
| Storage pressure | How per-account WAL pressure maps to the multi-account fan-out remediation and the ILatticeAdmin move workflow (signal-only in this release). |
| Observability | The orleans.lattice.scaling meter instruments and the bundled Grafana dashboard. |
Sample
samples/ClusterScaling is a deployable
Azure Container Apps sample: a multi-silo Orleans cluster on real Azure Storage
clustering and WAL via managed identity, co-hosting the gRPC data API and the
scaling endpoint, with a bundled load driver that drives the compute axis so KEDA
scales the replica count out.
Related
- Package overview:
src/lattice.scaling/NUGET_README.md. - Reference autoscaler manifests shipped in the package:
src/lattice.scaling/deploy/. - Bundled dashboards:
Orleans.Lattice.Dashboards.