Architecture Decision Record
ADR-127: The Actor Model Is Not Adopted
Status
Accepted (2026-09-22) as a documented rejection. Nothing ships with this record: no grain
interface, no silo, no placement configuration, no new package. What ships is the reason the actor
model was weighed and dropped, the alternative weighed with it, and the one condition that would make
it right to revisit. The existing path stays: EF over the owning module's own database, Redis-backed
caching, and the SignalR notification hub. Revised 2026-10-01: citations refreshed and the replica
wording corrected. Revised 2026-10-06: the replica wording now reflects that not every ADC app runs
minReplicas: 1 under conferenceMode. Revised 2026-10-07: the replica wording now reflects
that the ADC UI app holds four replicas under conferenceMode and the Notification app stays at a
ceiling of two, and anchors were refreshed. Revised 2026-10-21: anchors refreshed after the vote
handler, the live-channel drain and both apps' main.bicep scale blocks moved. Revised 2026-10-26:
anchors refreshed after the output-cache pipeline step and both apps' main.bicep scale blocks moved.
Revised 2026-10-28: anchors refreshed after both apps' main.bicep scale blocks moved.
Revised 2026-11-23: the concurrency token is now stated as configured for every relational context
(Cosmos configures none), the notification hub as mapped only when push notifications are enabled,
and anchors refreshed.
Context
The actor model gives every logical entity its own single-threaded unit of execution holding its state in memory and serializes all messages to that entity through it; a virtual-actor runtime makes the activation implicit. What that buys is single-writer semantics over high-cardinality per-entity in-memory state: many small entities, each mutated faster than a database round trip allows, each needing its own serialization point. It gets proposed here because ADC has a conference-day live layer, which sounds like that workload. It is not, and the difference is this record.
The live state is small, and it is database state. A live poll is an aggregate root with a status
and a set of options; a vote is a write through the module's unit of work
(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/CastVote/CastVoteHandler.cs:21,
the repository call at :40) and the tallies are a read through the same one
(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/GetPollResults/GetPollResultsHandler.cs:23).
Bookmark counts are a query behind a cross-module service contract rather than a resident counter
(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/UserSessionBookmarks/IBookmarkCountService.cs:11),
and session state is the caller's own row, read per request. Contention is handled by the database
rather than by a writer thread: on a relational engine every auditable entity carries an optimistic
concurrency token (MMCA.Common/Source/Core/MMCA.Common.Domain/Interfaces/IRowVersioned.cs:11),
generated by the database on SQL Server and stamped by the audit interceptor on PostgreSQL and SQLite
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Interceptors/AuditSaveChangesInterceptor.cs:67).
It is configured for every relational context in OnModelCreating
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/ApplicationDbContext.cs:530,
which calls ConfigureConcurrencyTokens at :556, defined at :737): IsRowVersion() at :750
when the engine's strategy is StoreGenerated (:740), as on the SQL Server databases both apps use
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DataSources/Engines/SQLServerDataSourceEngine.cs:46),
and IsConcurrencyToken() at :754 otherwise, which covers the ClientStamped PostgreSQL and SQLite
engines (PostgreSQLDataSourceEngine.cs:44, SqliteDataSourceEngine.cs:43). Cosmos configures no
concurrency token: its engine binds strategy None (CosmosDataSourceEngine.cs:46, the member at
RowVersionStrategy.cs:11) and its context skips the base OnModelCreating
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/CosmosDbContext.cs:139).
That is the single-writer guarantee an actor would provide, and it already holds across replicas,
which an in-process actor would not (ADR-035).
Fan-out is a push channel, not an actor mailbox. ILiveChannelPublisher is the port
(MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Notifications/ILiveChannelPublisher.cs:9),
its shipped adapter broadcasts through the SignalR hub
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Notifications/Live/SignalRLiveChannelPublisher.cs:11),
which is framework code
(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Notifications/NotificationHub.cs:25) mapped by
the host at startup when push notifications are enabled
(MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/SignalRExtensions.cs:31, behind the
Enabled check at :25; Enabled defaults to false,
MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Notifications/Push/PushNotificationSettings.cs:14).
The one host that maps it is ADC's Notification service
(MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:150, enabled in its
appsettings.json:37); Store maps no hub. ADC's Engagement
module reaches it off the command hot path through a single-reader drain that preserves per-session
ordering
(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:41,
resolving the publisher per item at :131), the one actor-shaped guarantee the live layer needs.
Read pressure is absorbed by caching, and the load is small. Tier 2 is an HTTP output cache in the
pipeline
(MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:140)
backed by Redis when a connection string is present
(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Caching/RedisCachingExtensions.cs:103, registered at
:111), with the Redis resource composed by each app's AppHost
(MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:44, the builder at :10), so a hot read path
never reaches the database. ADC serves a single conference's attendance over a few days, and a runtime
built for millions of addressable entities is not sized for that. Searches of both Source trees for
Orleans, IGrain, Akka and Proto.Actor return no match, so the absence is real.
Decision
Do not adopt the actor model, and do not introduce an actor runtime as a hosting layer. Per-entity state stays in the owning module's database behind optimistic concurrency, read pressure stays on the caching tiers, and live fan-out stays on the notification hub.
Rationale
- No workload has the shape. Actors earn their cost on high-cardinality per-entity in-memory state with single-writer semantics, and nothing here has all three: entity counts are small, state is durable rather than resident, and the writer guarantee is held by the concurrency token.
- It would be a third execution model. Modules run either in process behind the module contract or out of process behind gRPC (ADR-007, ADR-008); an actor runtime adds a third, with its own addressing, lifetime, placement and failure semantics for every module author to know.
- Grain state and database state would have to be reconciled. An in-memory authority over an entity that also has a row is two copies of the truth, while the one actor-shaped guarantee the live layer needs is already met by a drain (ADR-121).
- Operational cost does not scale down. A silo cluster needs membership, placement and its own failure modes in both production deployments, understood during an incident.
Trade-offs
- A genuinely actor-shaped workload will arrive without groundwork, and the first adoption pays the learning cost under whatever deadline produced the requirement.
- Some contention is answered with a retry rather than with a queue. Optimistic concurrency fails the losing writer, which would be the wrong answer for an entity many callers mutate continuously.
- Every live mutation costs a database round trip. Comfortable rather than free, and the number to watch, because it is the first thing that moves as the trigger below approaches. The rejection is scoped to the workloads that exist, and stops being true the moment that trigger is met.
Alternatives rejected
- Microsoft Orleans hosted under Aspire, weighed 2026-09-22 and rejected. Orleans is the .NET virtual-actor runtime and the option this record weighed. Aspire already composes the local stack (ADR-098), so a silo is cheap to stand up locally, and that is the trap: local composability is not the cost. The cost is a clustering provider and its membership store in both production deployments, grain lifetimes and placement to reason about, a second serialization contract beside the integration-event schema (ADR-010), and a second answer to where state lives.
- A hand-rolled in-memory per-entity lock or actor-like queue. It is per replica, and both apps scale
to more than one (every container app declares at least
maxReplicas: 2; underconferenceModethe ADC Identity, Conference, Engagement, Gateway and UI apps reach four while Notification stays at two; every app runsminReplicas: 1except the ADC Gateway, which runs two underconferenceMode, and the ADC UI, which then holds its ceiling of four:MMCA.ADC/infra/main.bicep:2394,:2548,:2696,:2887,:3039and:3190,conferenceFrontDoorMinReplicasat:213,conferenceScaledMaxReplicasat:214,MMCA.Store/infra/main.bicep:2020,:2144,:2311,:2429and:2547), so an in-process writer guarantee is not a guarantee, and it would silently weaken a correctness property the concurrency token holds across the fleet. - Adopting actors only for live polls. The live path is the least durable state in the system and the most visible during the event, so its first production exercise would fall on the day itself.
When to revisit
Revisit when a real-time per-entity state workload appears that optimistic concurrency plus Redis cannot carry: an entity mutated by enough concurrent callers that the concurrency-token retry rate becomes the bottleneck rather than an edge case, holding state that must be authoritative in memory between mutations. The check is a retry rate and a write latency, not an opinion about the model.
When the trigger is met, host Orleans per module behind the existing module contract, never as a system-wide runtime. A module already runs either in process or as its own service (ADR-008) and its callers reach it through an interface its own project declares (ADR-059), so a silo inside one module's service is contained. An actor runtime beneath every module is the opposite decision, rejected here.
Revision (2026-10-01)
No decision or rationale changed. Citations refreshed: the vote handler's class declaration
(CastVoteHandler.cs:20) and its poll repository call (:33), OnModelCreating
(ApplicationDbContext.cs:416), and the output-cache pipeline step (MiddlewarePipelineBuilder.cs:133).
One wording correction: both apps scale to more than one replica rather than running more than one at
baseline, since every container app declares minReplicas: 1 and at least maxReplicas: 2 (four for
the scaled ADC apps under conferenceMode)
(MMCA.ADC/infra/main.bicep:1882, conferenceScaledMaxReplicas at :191, MMCA.Store/infra/main.bicep:1591); a per-replica writer guarantee
still fails at two replicas, so the argument holds.
Revision (2026-10-06)
No decision or rationale changed.
- Replica wording corrected: not every container app is
minReplicas: 1. The two ADC front-door apps useconferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:190, used at:2493and:2639), which is 2 underconferenceMode; every other ADC app and every Store app stays atminReplicas: 1, and every app still declares at leastmaxReplicas: 2, so the per-replica argument holds. - AppHost anchors moved: the Redis resource is
Program.cs:43and the builder:9. - Every other anchor in the live sections was re-verified against current source and still matches.
Revision (2026-10-07)
Re-verified against current source. No decision or rationale changed: every container app still
declares at least maxReplicas: 2, so a per-replica writer guarantee still fails and the argument
holds. The replica detail moved and the anchors were re-pointed.
- Replica wording corrected: the two ADC front-door apps do not share one floor. The Gateway uses
conferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:2540, 2 underconferenceMode), while the UI usesconferenceMode ? conferenceScaledMaxReplicas : conferenceFrontDoorMinReplicas(:2691), so it holds four underconferenceMode. Notification stays atminReplicas: 1,maxReplicas: 2and is offconferenceScaledMaxReplicas(:2388), so "four for the scaled ADC apps" covers Identity, Conference, Engagement, Gateway and UI (:1914,:2067,:2202,:2541,:2692) only. - Anchors re-verified against current source:
conferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:191) andconferenceScaledMaxReplicas(:192), replacing:1882(now a probe comment),:190,:2493and:2639;OnModelCreating(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/ApplicationDbContext.cs:417,ConfigureConcurrencyTokensat:589,IsRowVersion()at:602on a store-generated engine andIsConcurrencyToken()at:606otherwise);LiveChannelPublishProcessor(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:40, per-item publisher resolution at:127, the single-reader FIFO drain unchanged); the AppHost Redis resource (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:44) and builder (:10).MMCA.Store/infra/main.bicep:1591still holds.
Revision (2026-10-21)
Re-verified against current source. No decision or rationale changed: every container app still
declares at least maxReplicas: 2, the replica floors and ceilings match the 2026-10-07 wording, and
the single-reader FIFO drain is unchanged. Only anchors moved.
- Anchors re-verified against current source: the vote handler's class declaration
(
MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/CastVote/CastVoteHandler.cs:21, was:20) and its poll repository call (:40, was:33);LiveChannelPublishProcessor(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:41, was:40) and its per-item publisher resolution (:131, was:127), with the single reader atMMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveChannelPublishQueue.cs:37; the ADC scale blocks for Identity, Conference and Engagement (MMCA.ADC/infra/main.bicep:2070,:2223,:2358, min 1 and maxconferenceScaledMaxReplicas), Notification (:2544, min 1 and max 2), Gateway (:2696, minconferenceFrontDoorMinReplicas) and UI (:2847, minconferenceMode ? conferenceScaledMaxReplicas : conferenceFrontDoorMinReplicas), replacing:1914,:2067,:2202,:2388,:2540and:2691; and every Store scale block (MMCA.Store/infra/main.bicep:1682,:1806,:1954,:2072and:2190, all min 1 and max 2), replacing:1591.conferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:191),conferenceScaledMaxReplicas(:192),OnModelCreating(ApplicationDbContext.cs:417,ConfigureConcurrencyTokensat:421and:589,IsRowVersion()at:602,IsConcurrencyToken()at:606) and the AppHost Redis resource and builder (Program.cs:44and:10) still hold.
Revision (2026-10-26)
Re-verified against current source. No decision or rationale changed: every container app still
declares at least maxReplicas: 2, and the replica floors and ceilings match the 2026-10-07 wording.
Only anchors moved.
- Anchors re-verified against current source: the output-cache pipeline step
(
MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:131,UseOutputCache()at:132, was:133); the ADC scale blocks for Identity, Conference and Engagement (MMCA.ADC/infra/main.bicep:2106,:2259,:2394, min 1 and maxconferenceScaledMaxReplicas), Notification (:2580, min 1 and max 2), Gateway (:2732, minconferenceFrontDoorMinReplicas) and UI (:2883, minconferenceMode ? conferenceScaledMaxReplicas : conferenceFrontDoorMinReplicas), replacing:2070,:2223,:2358,:2544,:2696and:2847; and every Store scale block (MMCA.Store/infra/main.bicep:1688,:1812,:1960,:2078and:2196, all min 1 and max 2), replacing:1682,:1806,:1954,:2072and:2190.
Revision (2026-10-28)
Re-verified against current source. No decision or rationale changed: every container app still
declares at least maxReplicas: 2, and the replica floors and ceilings match the 2026-10-07 wording.
Only anchors moved.
- Anchors re-verified against current source: the ADC scale blocks for Identity, Conference and
Engagement (
MMCA.ADC/infra/main.bicep:2103,:2256,:2391, min 1 and maxconferenceScaledMaxReplicas), Notification (:2577, min 1 and max 2), Gateway (:2729, minconferenceFrontDoorMinReplicas, maxconferenceScaledMaxReplicasat:2730) and UI (:2880, minconferenceMode ? conferenceScaledMaxReplicas : conferenceFrontDoorMinReplicas, max at:2881), replacing:2106,:2259,:2394,:2580,:2732and:2883; and every Store scale block (MMCA.Store/infra/main.bicep:1689,:1813,:1961,:2079and:2197, all min 1 and max 2), replacing:1688,:1812,:1960,:2078and:2196.conferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:191) andconferenceScaledMaxReplicas(:192) still hold.
Revision (2026-11-23)
Re-verified against current source. No decision or rationale changed: every container app still
declares at least maxReplicas: 2, the replica floors and ceilings match the 2026-10-07 wording, and
both apps run on SQL Server, where the store-generated row version holds. Two statements were
narrowed to what source shows, and the anchors were re-pointed.
- The concurrency token is configured for every relational context, not every context.
The token is database-generated only on SQL Server; PostgreSQL and SQLite carry one the audit
interceptor stamps
(
MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Interceptors/AuditSaveChangesInterceptor.cs:67).ConfigureConcurrencyTokensmapsIsRowVersion()when the engine's strategy isStoreGenerated(ApplicationDbContext.cs:740,:748), bound by SQL Server (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DataSources/Engines/SQLServerDataSourceEngine.cs:46), andIsConcurrencyToken()otherwise (:752), which covers theClientStampedPostgreSQL and SQLite engines (PostgreSQLDataSourceEngine.cs:44,SqliteDataSourceEngine.cs:43). Cosmos bindsNone(CosmosDataSourceEngine.cs:46, the member atRowVersionStrategy.cs:11) and its context does not call the baseOnModelCreating(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/CosmosDbContext.cs:139). - The notification hub is mapped only when push notifications are enabled:
MapNotificationHub(MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/SignalRExtensions.cs:22) callsMapHub<NotificationHub>(:31) inside theEnabledcheck (:25), andEnableddefaults to false (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Notifications/Push/PushNotificationSettings.cs:14). ADC's Notification service is the one host that maps it (MMCA.ADC/Source/Services/MMCA.ADC.Notification.Service/Program.cs:150, enabled atappsettings.json:37); Store maps no hub. - Anchors re-verified against current source:
OnModelCreating(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DbContexts/ApplicationDbContext.cs:530, was:417), itsConfigureConcurrencyTokenscall (:556, was:421) and definition (:737, was:589),IsRowVersion()(:750, was:602) andIsConcurrencyToken()(:754, was:606); the hub mapping (SignalRExtensions.cs:31, was:27); the output-cache pipeline step (MMCA.Common/Source/Presentation/MMCA.Common.API/Startup/Pipeline/MiddlewarePipelineBuilder.cs:140, was:131, withUseOutputCache()at:141, was:132);AddRedisOutputCaching(MMCA.Common/Source/Hosting/MMCA.Common.Aspire/Caching/RedisCachingExtensions.cs:103, was:91) and itsAddStackExchangeRedisOutputCacheregistration (:111, was:99);conferenceFrontDoorMinReplicas(MMCA.ADC/infra/main.bicep:213, was:191) andconferenceScaledMaxReplicas(:214, was:192); the ADC scale blocks for Identity, Conference and Engagement (:2394,:2548,:2696, min 1 and maxconferenceScaledMaxReplicas), Notification (:2887, min 1 and max 2), Gateway (:3039, minconferenceFrontDoorMinReplicas, maxconferenceScaledMaxReplicasat:3040) and UI (:3190, minconferenceMode ? conferenceScaledMaxReplicas : conferenceFrontDoorMinReplicas, max at:3191), replacing:2103,:2256,:2391,:2577,:2729and:2880; and every Store scale block (MMCA.Store/infra/main.bicep:2020,:2144,:2311,:2429and:2547, all min 1 and max 2), replacing:1689,:1813,:1961,:2079and:2197.
Related
ADR-007, ADR-008 and ADR-059 (the boundary a future silo would live behind), ADR-026 and ADR-077 (the caching tiers that absorb the read pressure, and the in-process residency the system does buy), ADR-098 (Aspire's scope, and why a silo being easy to add locally is not an argument for one), ADR-035 (the row-version token that already provides the single-writer guarantee, across replicas), ADR-039 and ADR-121 (the live push channel, and the drain that carries its fan-out today).