.NET › Blazor (Server & WebAssembly)
What is a 'circuit' in Blazor Server, and how does server-side state management work across it?
AdvancedAnswer
A circuit represents the server-side connection and state for one Blazor Server user session -- it holds the component tree, its current render state, and any DHTML event handlers, kept alive on the server for the browser tab's lifetime via the SignalR connection. Because state lives server-side per circuit, Blazor Server apps consume server memory proportional to concurrently connected users, unlike Blazor WebAssembly where all state lives in the client's browser memory instead.
// Server memory scales with concurrent circuits:
// 1000 concurrent Blazor Server users = 1000 active circuits
// each holding component state, consuming server RAM
builder.Services.Configure<CircuitOptions>(options => {
options.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(3);
});Real-world example A capacity-planning exercise for a Blazor Server application estimates server memory needs based on expected concurrent circuit count, a scaling consideration that simply doesn't apply the same way to a Blazor WebAssembly deployment.