Configure observers in Cratis Chronicle Server
Observer configuration controls retry behavior, timeouts, watchdog monitoring, and how events fan out to scaled-out client instances.
Example configuration
Section titled “Example configuration”{ "observers": { "subscriberTimeout": 30, "liveDeliveryBudget": 100, "abandonedDeliveryHold": 300, "maxEventsPerSubscriberCall": 100, "maxEventsPerPage": 1000, "maxBytesPerSubscriberCall": 4194304, "maxRetryAttempts": 10, "backoffDelay": 1, "exponentialBackoffDelayFactor": 2, "maximumBackoffDelay": 600, "quarantineOnFailedPartitionCount": 0, "quarantineOnFailedPartitionPercentage": 0.0, "definitionEvolution": "Automatic", "watchdogInterval": 60, "idleDeactivationAfter": 900, "durableSubscriptions": "Release", "dormantAfter": 900, "dormantSafetyNet": 900, "maxConcurrentWakes": 0, "maxConcurrentCatchUpJobs": 16, "durableSubscriptionCheckInterval": "00:15:00", "unseenRemovalEnabled": false, "unseenRemovalAfter": "7.00:00:00", "unseenRemovalSweepInterval": "01:00:00", "unseenRemovalBatchSize": 100, "maxConcurrentPartitions": 32, "maxConcurrentRegistrations": 16, "maxConcurrentSubscriptions": 0, "fanOutStrategy": "round-robin", "subscriptionReadyTimeout": 5, "statePersistenceBatchInterval": 100, "writeCoalescingInterval": 5, "generationPromotion": "OnCatchUp", "deploymentConditionGracePeriod": "00:01:00", "pendingGenerationAlertAfter": "1.00:00:00" }}The example shows the defaults of a production build. The -development image ships two overrides, subscriberTimeout 5 and replayOnDefinitionChange true. See Development and production images.
| Property | Type | Default | Description |
|---|---|---|---|
| subscriberTimeout | number | 30 | How many seconds an observer waits for its subscriber to answer a batch before giving up on it. Not capped by clustering.responseTimeout during catch-up, replay and partition recovery; bounded at 1 hour. Live delivery stays below the Orleans response timeout. 0 waits indefinitely (up to that bound). See Subscriber timeout |
| liveDeliveryBudget | number | 100 | Maximum events delivered inline in one live call. Larger batches are deferred to partition catch-up without advancing the live position. 0 or less disables the limit. Catch-up and replay are unaffected |
| abandonedDeliveryHold | number | 300 | Maximum additional seconds to hold an abandoned gRPC client delivery. Positive values are at least subscriberTimeout. 0 or less disables fencing; a disabled subscriber timeout also disables it. See Abandoned client deliveries |
| maxEventsPerSubscriberCall | number | 100 | The most events handed to a gRPC client (reactor or reducer) or webhook subscriber in one call during catch-up, replay and partition recovery. 0 or less hands over storage batches as read. See Bounded subscriber calls |
| maxEventsPerPage | number | 1000 | The most events in one page for a client reactor or reducer that declared page bounds, on every path. Caps the declared bound; never makes a page larger than the path hands over. 0 or less sets no count limit. See Page bounds |
| maxBytesPerSubscriberCall | number | 4194304 | The most bytes in one page for a client reactor or reducer that declared page bounds, on every path: event content, and for a reducer the states it reduces from. 0 or less sets no size limit. See Page bounds |
| maxRetryAttempts | number | 10 | Maximum retry attempts for failed partitions (0 = infinite). The limit applies per retry budget: clearing the quarantine of a partition starts a new budget, so it gets this many attempts again. An attempt that fails at a later event than the previous one made progress and also starts a new budget, so only a partition that keeps failing at the same event is quarantined |
| quarantineOnFailedPartitionCount | number | 0 | Quarantine the observer once this many of its partitions have failed (0 = never) |
| quarantineOnFailedPartitionPercentage | number | 0.0 | Quarantine the observer once this share of its observed partitions have failed (0.0 = never) |
| backoffDelay | number | 1 | Initial backoff delay in seconds |
| exponentialBackoffDelayFactor | number | 2 | Exponential backoff multiplier |
| maximumBackoffDelay | number | 600 | Maximum backoff delay in seconds |
| definitionEvolution | string | Automatic | Controls whether projection and reducer definition changes apply Automatic, PartialOnly, or Manual evolution. See Definition evolution |
| replayOnDefinitionChange | boolean | false | Controls automatic replay for reactors and webhooks. Projection and reducer changes use definitionEvolution |
| watchdogInterval | number | 60 | Interval in seconds between watchdog checks, run for every resident observer by the silo’s supervisor (see The supervisor); the watchdog verifies connected clients are still active, running jobs (replay and catch-up) are still progressing, and NextEventSequenceNumber is up-to-date |
| stallWindow | timespan | 00:03:00 |
How long a resident observer’s position (NextEventSequenceNumber) must stay put while an event it observes is waiting and the end of the event sequence keeps advancing, before its measured progress is reported as stalled. Three watchdog ticks at the default watchdogInterval. A zero or negative value uses the default. Observers with additional tag, event source type or event stream type filters, observers catching up, and observers that are not active and connected are never reported as stalled. The watchdog takes a sample on each tick that reaches its tail lookup, and a sample stops describing the observer after two watchdog intervals (not after the stall window), after which the observer reports no sample until the next tick. The same sample is published as the cratis.chronicle.observer.lag_distance and cratis.chronicle.observer.stalled metrics (see OpenTelemetry) |
| idleDeactivationAfter | number | 900 | Seconds an observer with no subscription and no pending work stays in memory before it is released. A subscribed observer always stays in memory. 0 keeps every observer in memory. See Releasing idle observers |
| durableSubscriptions | string | Release |
Whether an observer records its subscription (what serves it, its filters and, for client observers, the connections it delivers to) in its own state, and what is done with the record. Release records it and releases a subscribed observer that has nothing to do, then wakes it from the record. Shadow records it without releasing anything. Off records nothing, clears what is stored and keeps every subscribed observer in memory. See Releasing dormant observers and Recording subscriptions |
| durableSubscriptionCheckInterval | timespan | 00:15:00 |
No longer used: the appended events queues no longer compare recorded subscriptions with their live ones. Kept so existing configuration still loads |
| dormantAfter | number | 900 | Seconds a subscribed client reactor, client reducer or projection with nothing to do stays in memory before it is released. 0 keeps every subscribed observer in memory. Applies only while durableSubscriptions is Release and every silo of the cluster supports it. See Releasing dormant observers |
| dormantKinds | array | empty (client reactors, client reducers, projections, collapsing projections, event store subscriptions and pattern capture) | The kinds of observer that are released when dormant. When set, only the listed kinds (ClientReactor, ClientReducer, Projection, CollapsingProjection, EventStoreSubscription, PatternCapture) are released and the others stay in memory. Kernel reactors and webhooks are never released. Applies only while dormantAfter is above 0. |
| dormantSafetyNet | number | 900 | Most seconds that pass before the safety net of an appended events queue looks at the observers it holds no live subscription for and wakes those that have an event waiting, which bounds how long a lost wake-up can delay delivery. Each queue’s interval is jittered between 60% and 90% of this value. Values below 1 use the default |
| dormantSafetyNetFullWake | number | 3600 | Most seconds between two wake-ups of an observer that stays without a live subscription after it was woken, such as one whose client is gone. The first repeat waits a minute and each one after it waits twice as long, up to this value. Values below 1 use the default |
| maxConcurrentWakes | number | 0 (automatic) | How many dormant observers one silo wakes at the same time. 0 or less selects two per processor, at least 4 and at most 16. The others wait for a place |
| maxConcurrentCatchUpJobs | number | 16 | How many catch-up jobs run at the same time in one event store namespace. Past it, an observer that needs a catch-up job stays behind and tries again after a few seconds. 0 or less lifts the limit. See Catch-up when clients return |
| dormantResumeMaxEvents | number | 1000 | Most events a woken observer reads and delivers from its cursor itself. A larger gap falls back to a catch-up job. Values below 1 use the default |
| unseenRemovalEnabled | boolean | false |
Turns on the removal of client reactors and reducers that no client has used for unseenRemovalAfter. Off by default: nothing is removed unless you turn it on. A removed observer replays from the start if its client returns. See Removing observers no client has used |
| unseenRemovalAfter | timespan | 7.00:00:00 |
How long a client reactor or reducer can go without any client subscribed to it, in every namespace, before Chronicle removes it and its records, when unseenRemovalEnabled is on. Seven days is the recommended period; a zero or negative value uses it. Has no effect while the removal is off |
| unseenRemovalSweepInterval | timespan | 01:00:00 |
How often each silo looks for observers that have not been seen for unseenRemovalAfter, when unseenRemovalEnabled is on. The sweep reads storage and only activates an observer that is a candidate for removal |
| unseenRemovalBatchSize | number | 100 | How many observers one storage read of that sweep covers. A value below 1 uses the default |
| maxCatchupRecoveryAttempts | number | 5 | How many watchdog checks in a row may retry a stuck catch-up preparation, or a recovery that failed after quarantine was cleared, before the watchdog quarantines the observer. 0 or less quarantines on the first retry. See Ending quarantine |
| maxConcurrentPartitions | number | 32 | Upper bound on how many job steps (replay and catch-up work) run in parallel. The effective limit is the smaller of this value and jobs.maxParallelSteps. Despite the name it does not limit live event delivery. See Job throttling |
| maxConcurrentRegistrations | number | 16 | Maximum gRPC reactor and reducer registrations running concurrently on each silo. Excess registrations wait before any registration grain or read-model lookup. Values below 1 disable the gate. Does not limit event append or observer delivery. See Registration concurrency |
| maxConcurrentSubscriptions | number | 0 (automatic) | Maximum projection subscriptions and failed-partition recovery batches running concurrently on each silo, shared by every event store. 0 or less selects two per processor, at least 4 and at most 16. See Subscription concurrency |
| fanOutStrategy | string | round-robin | Strategy for distributing events across multiple connected instances of the same client. round-robin distributes deterministically by partition key, keeping every partition sticky to one instance and preserving per-partition ordering. random picks a random instance per delivery |
| subscriptionReadyTimeout | number | 5 | Seconds the Kernel waits for an event store subscription to become ready before it returns to the client. The wait keeps events from being missed when the client starts appending right away. When it elapses the subscription can still activate afterwards and the client is not blocked further. Raise it only when clients report subscriptions that are not ready on a slow or busy cluster |
| statePersistenceBatchInterval | number | 100 | Number of batches that contain nothing the observer subscribes to after which its position (NextEventSequenceNumber) is made durable. The watchdog tick and deactivation also flush it. After a crash, catch-up re-scans events the observer already skipped, so nothing is lost or handled twice. A larger value means fewer writes and a longer re-scan after a crash |
| writeCoalescingInterval | number | 5 | Most seconds the observer holds back reported handled-event counts and the follow-up writes of partition failures before it makes them durable. The sums stay exact; only their freshness is bounded. 0 writes everything through, which can make the observer’s call queue grow past the grain call timeout during a large replay |
| generationPromotion | string | OnCatchUp | How a new projection generation is promoted. OnCatchUp promotes automatically once catch-up and readiness are proven, Operator waits for an explicit operator request, Deployment waits until the connected declaring clients meet the required version, and Gated holds promotion until the gate is released. Applies only when features.projectionGenerations is enabled. See Read models |
| deploymentConditionGracePeriod | timespan | 00:01:00 |
How long the Deployment condition must hold before the generation is promoted. Applies only when features.projectionGenerations is enabled |
| pendingGenerationAlertAfter | timespan | 1.00:00:00 |
How long a generation can stay pending before Chronicle raises an alert. Applies only when features.projectionGenerations is enabled |
BackoffScheduleSeconds (empty by default) and RetryBudget (00:00:00 by default) belong to the shared retry options type but are used only under webhooks.retry, not for ordinary observers. Webhooks supply their own schedule and budget defaults; see Delivery retry policy.
The supervisor
Section titled “The supervisor”Each silo runs one supervisor that carries out the periodic duties of the grains resident on it. A resident observer registers with it when it activates and leaves it when it deactivates, and the supervisor runs the observer’s watchdog through the grain every watchdogInterval seconds, so the duties still run one at a time in a turn of the observer. The event log of each namespace, the captures manager of each event store and the connected clients registry of each silo register the same way.
This replaces the grain timers those grains used to arm, so the number of timers on a silo no longer grows with the number of observers or namespaces. The supervisor looks at its registry once a second and starts the watchdog of every observer that is due; an observer whose watchdog is still running is skipped, and its next one is due an interval after the last one finished.
An activation that is alive no longer notices by itself that something is wrong. Two events cover for that:
- A silo leaves the cluster. For
connectedClients.subscriptionSettleSecondsafter a departure, the supervisor asks every resident observer, once everyconnectedClients.reviseIntervalSeconds, to verify that its appended-events queue still holds its subscription, and to re-route when it does not. It also reconciles the projection, capture and pattern-capture subscriptions of every namespace and re-checks the subscriptions kept for connected clients. The asks are spread over each interval in batches rather than all at once. - A client disconnects. The connection reports it at once, and the observers it served are told without waiting for a watchdog tick. The connected clients registry only revises on a slow interval, at least
connectedClients.staleThresholdSeconds, to catch a client that vanished without closing its connection.
A namespace is reconciled when its event log activates and after a silo departure. A pass that fails is retried every watchdogInterval seconds until one succeeds; a healthy namespace costs nothing between departures.
Releasing idle observers
Section titled “Releasing idle observers”Every observer, reactor and reducer is an activation in the Kernel’s memory, and each one costs roughly 40 KB of heap. A subscribed observer has to stay in memory, because its live subscription to new events exists only there. An observer whose client has disconnected, or one that was only loaded to answer a question, has nothing in memory that is not also in storage.
The watchdog releases such an observer once it has found it idle for idleDeactivationAfter seconds. Idle means all of the following:
- It has not been removed, has no subscription and is disconnected.
- It has no failed partitions and is not quarantined.
- It is not replaying or catching up, and has no catch-up starting.
- It has no alert, webhook probe, state write or retry reminder waiting.
- It holds no request for later, such as a start-at-tail request waiting for its subscription or a partition recovery that an operator asked for.
An observer is not idle while an alert reminder is registered for it. An observer with nothing to report gives the reminder up on its first tick, one to two minutes after it was activated, so an observer that has a reminder when a call activates it is released after about two minutes plus idleDeactivationAfter. A call for an observer that does not exist in the namespace has no alerts to report, so that activation only waits for the idle period.
When anything calls a released observer again, for example a client that reconnects, it is activated from storage.
Set idleDeactivationAfter to 0 to keep every observer in memory. The release is checked on every watchdog tick, so an idle observer is released between idleDeactivationAfter and idleDeactivationAfter + watchdogInterval seconds after it became idle.
Recording subscriptions
Section titled “Recording subscriptions”A subscription exists in memory: in the observer’s activation and in the appended events queue it subscribed to. With durableSubscriptions set to Release (the default) or Shadow the observer also records the facts of its subscription in its own state document, in the same write that records the subscription: what serves it (client reactor, client reducer, projection, kernel reactor, webhook or event store subscription), whether it delivers pages, its filters and, for client observers, the connection identifier and silo of every client it delivers to and, when a service has several replicas that registered different definitions of the observer, the registrations of the replicas that do not hold the subscription (its standbys, with the definition each registered). It clears the record when it unsubscribes or is deactivated; a silo that shuts down leaves it as it is.
The record does not change how a resident observer delivers events. With durableSubscriptions set to Release (the default) it is what an observer is released and woken from (see Releasing dormant observers). The observer also tells its supervisor, the one grain per event store and observer that every namespace shares, which connection serves it; the supervisor holds that in memory only, and an observer that wakes without a record of its own resumes from it. Set durableSubscriptions to Off to stop recording and to clear the stored records.
The record is one optional field, so a rolling upgrade needs nothing special: an older silo ignores it. SQL stores add a nullable DurableSubscription column to the observer table.
Releasing dormant observers
Section titled “Releasing dormant observers”A client reactor, client reducer, projection or event store subscription that is subscribed and has nothing to do still holds a grain activation and its state in memory. With thousands of observers that is most of the memory a kernel uses, and almost all of it belongs to observers that are idle. Chronicle releases such an observer after it has been dormant for dormantAfter seconds (15 minutes by default) and wakes it when it has work again.
What dormant means. An observer is dormant when it is subscribed, active and owes nothing: no event is being delivered, no partition has failed, no catch-up, replay or job is running, it is not quarantined, and no delivery fence is open. Its subscription does not go away. It stays recorded in the observer’s state (see Recording subscriptions). The appended events queue keeps nothing for it: each silo holds a routing table of which observers take which event types, and the queue knows the observers of its namespace from their stored positions. An observer that keeps standby registrations for the other replicas of a service is dormant like any other, because the record names them. A listing or an inspection of observers reports a dormant observer as subscribed, and reading it, or its connected clients, does not wake it.
What wakes it. The queue wakes a dormant observer when an event it observes is appended. The observer reads its cursor, finds the events appended since, handles them in order and exactly once, and goes dormant again after dormantAfter seconds. Events of types it does not observe never wake it. If more events arrived than dormantResumeMaxEvents, the observer resumes through a catch-up job instead of delivering inside its activation. At most maxConcurrentWakes observers wake at the same time on a silo, so an event that many observers watch becomes a short queue instead of a spike of activations.
The safety net. A wake-up can be lost, for example while a silo is restarting. Each queue therefore looks at the observers it holds no live subscription for once every dormantSafetyNet seconds, drawn per queue between 60% and 90% of that value so the queues do not line up. A check compares each observer’s persisted cursor with the tail of the event types it observes, reading the cursors once per event sequence, and wakes the observer only when an event is waiting for it. An observer that is up to date is not activated. An observer whose tail cannot be read is woken, so a check that cannot tell errs toward waking. The safety net bounds the delay of a lost wake-up to 15 minutes by default, and costs nothing for an observer that has nothing waiting. It is driven from the queue, so no timer is held for a dormant observer.
An observer that stays without a live subscription after it was woken, such as one whose client is gone, is not woken for every event: the queue waits a minute before it wakes it again, then twice as long each time, up to dormantSafetyNetFullWake seconds (an hour by default).
Clients that leave. A record that names a client that is gone is repaired when the observer wakes: every client it names is checked against the clients connected at that moment, so nothing is swept while the observer is dormant. When the client that held the subscription is the one that is gone, the observer promotes the most recent standby whose client is still connected, under the definition that standby registered, and skips the standbys that have left; with none left it is disconnected until a client registers it again. None of this keeps anything in memory for a dormant observer. A client that is gone starts the clock of removing unseen observers at the moment it left, and a dormant observer is never removed while a record names a client, because that is a client holding it.
The keeper of a client stream. The open stream of a client confirms that its subscriptions are intact. With connectedClients.keeperMode set to SiloLocal (the default) a dormant observer whose recorded subscription names this client on this silo is confirmed without being asked, so the check does not wake it. The queue that holds the observer as dormant is what says the record is its subscription: an observer that is resident, has no record, or has a record naming another connection or silo is asked, which restores whatever was lost, including the live subscription of an observer whose silo was lost. Projections that are dormant are not asked when the kernel starts or a silo leaves either. Set connectedClients.keeperMode to Legacy to ask the observer on every check, as earlier releases did.
What is not released. Observers that are replaying, catching up or quarantined, have failed partitions or unfinished jobs, or serve a webhook, stay resident. So does an event store subscription that pins a generation of its event types. Which kinds are released is set with observers.dormantKinds. So does an observer in a cluster where any silo runs a release before 19.173.0, or that has not yet published its release: dormant release applies only while every silo of the cluster supports it, and is evaluated again at every decision, so a rolling upgrade is safe in both directions.
A new observer. An observer is not released until its alert reminder has ticked once, which Orleans schedules between one and two minutes after it subscribed, and then removed itself. Expect an observer to become dormant a few minutes after it subscribes.
Turning it off
Section titled “Turning it off”| To | Set |
|---|---|
| Keep every subscribed observer in memory, as before | observers.dormantAfter to 0 |
| Keep event store subscriptions in memory | observers.dormantKinds to the other kinds, for example ClientReactor, ClientReducer, Projection and CollapsingProjection |
| Stop recording subscriptions and clear the stored records | observers.durableSubscriptions to Off |
| Record and compare, without releasing | observers.durableSubscriptions to Shadow |
| Ask the observer on every check of a stream | connectedClients.keeperMode to Legacy |
| Make wakes less bursty | lower observers.maxConcurrentWakes |
Catch-up when clients return
Section titled “Catch-up when clients return”When a client application drops and returns, every observer it owns needs a catch-up job. Two rules keep that from becoming a burst of kernel work:
- An observer owned by a client with no connected instance starts no catch-up, partition catch-up or retry job. Such a job can only fail. The observer stays behind and catches up when its client subscribes again.
- At most
maxConcurrentCatchUpJobscatch-up jobs run at once in a namespace. An observer past the limit settles and tries again after five to ten seconds. A place that comes free goes to the observer furthest behind its event sequence (the one that has waited longest among equals), so a burst drains the largest backlogs first. An observer that already has a catch-up job is never held back.
Both are counted in cratis.chronicle.observer.catch_up_deferrals, by cratis.chronicle.observer.catch_up_deferral_reason: no_client or capacity. A persistently high capacity count means the limit is lower than your reconnect bursts need; no_client is expected while a client application is down.
Metrics to watch
Section titled “Metrics to watch”| Metric | Reports |
|---|---|
cratis.chronicle.observer.dormant |
Observers held as dormant on the silo, per event store and namespace. Drops back to 0 rather than disappearing |
cratis.chronicle.observer.resident |
Observers that hold an activation. Falls as observer.dormant rises |
cratis.chronicle.observer.dormant_releases |
Observers released while dormant |
cratis.chronicle.observer.dormant_wakes |
Dormant observers woken, by cratis.chronicle.observer.wake_cause: event or safety_net |
cratis.chronicle.observer.dormant_safety_net_checks |
Dormant observers the safety net looked at, by cratis.chronicle.observer.safety_net_outcome: up_to_date (nothing waiting, not activated), behind (an event is waiting, woken), unverified (the cursor or tail could not be read, woken) or full_wake (due for the unconditional wake, woken). Most checks should be up_to_date |
cratis.chronicle.observer.dormant_wakes_delayed |
Wakes that had to wait for a place under maxConcurrentWakes. Persistently high means the limit is too low for your bursts |
cratis.chronicle.observer.catch_up_deferrals |
Catch-ups that did not start a job, by cratis.chronicle.observer.catch_up_deferral_reason: no_client (the client is not connected) or capacity (maxConcurrentCatchUpJobs jobs are already running) |
cratis.chronicle.observer.dormant_resumes |
Woken observers by cratis.chronicle.observer.resume_outcome: cursor (read and delivered by the observer), catch_up (the gap was larger than dormantResumeMaxEvents) or stale_record (the record named a client that is gone) |
A dormant observer is not a stuck observer: it reports as subscribed and its running state stays Active. If delivery to an observer stalls, look at its failed partitions and its last handled event sequence number as before. Many behind checks, rather than event wakes, mean wake-ups are being lost.
Upgrading
Section titled “Upgrading”Upgrading changes behavior without any configuration: observers are released after fifteen minutes of having nothing to do, and the keeper of a client stream stops asking dormant observers. The memory of the kernel falls by what idle observers held, and the first event for a released observer pays one activation, usually a millisecond or two. A kernel that must keep every observer in memory sets observers.dormantAfter to 0.
During a rolling upgrade nothing is released until every silo runs the release that supports it, and an older silo neither writes nor clears the record, so the observers it hosts are never released. The grain interfaces of the release that removed the per-connection client reactor and reducer grains no longer match those of earlier releases, so that release is a stop-start deploy: stop every silo, then start the new release. The clients keep the same stream and reconnect on their own, and the stored subscriptions and definitions are unchanged.
What serves a connected client
Section titled “What serves a connected client”A client reactor or reducer is served by the open stream of its connection. The stream subscribes the observer, keeps the subscription in place, and unsubscribes it when the stream ends, so a connected client holds no grain activation of its own: with thousands of connected observers the kernel has the observers and nothing per connection beside them. Events are delivered to the client through the observer’s subscriber, in the order the observer delivers them, as before.
One stream for every observer of a connection
Section titled “One stream for every observer of a connection”A client that supports it observes with every reactor and reducer of a connection over one HTTP/2 stream instead of one stream each. The kernel advertises this as the multiplexed-observation capability when a client connects, and a client uses it only when it sees that capability. A client that does not (an older client, or one with multiplexing turned off) keeps one stream per reactor and reducer, and the kernel serves both kinds side by side: nothing in the kernel needs configuring, and a rolling deploy is safe in both directions.
On a shared stream:
- Each reactor or reducer is a sub-stream with an identifier chosen by the client. The kernel serves it with the same code that serves a per-observer stream, so registration, the registration gate, the subscription checks and the disconnect handling are the ones described above and below.
- Registrations travel together. A client that has many observers to register, at start-up or after a reconnect, sends them in one write, and the kernel starts them as it would have started the separate calls. The registration concurrency limit still applies per silo.
- A sub-stream that fails or ends reports its own gRPC status and leaves the others alone. When the connection itself ends, every sub-stream on it ends, exactly as every per-observer stream of a lost connection does, and the client re-registers.
- Ordering and flow control are per observer. Messages of one sub-stream arrive in the order the observer produced them (each carries a sequence number), and the delivery acknowledgment bounds what a client can owe: the kernel does not hand an observer the next delivery for a partition before the client answered the last. A client that is slow to take one observer’s events holds up that observer only.
Open HTTP/2 streams drop from one per observer to one per connection. Measured on loopback (--client-streams, 11 000 observers), the transport state of the open streams was about 200 MB (about 19 KB per stream, client and server together) with one stream per observer and about 0.3 MB with one shared stream. The kernel still keeps its per-observer state (the observer and the sub-stream’s registration), which this does not change.
HTTP/2 stream limits
Section titled “HTTP/2 stream limits”The kernel listener allows 100 concurrent HTTP/2 streams per connection. A client with many observers opens further connections as needed, and measuring on loopback showed that this limit does not make a reconnect of thousands of observers slow or fail: 11 000 per-observer streams over a real Kestrel listener were established in about 0.5 s with the default limit (and in about 0.6 s with the limit raised above the stream count, over one connection). Raising the limit therefore buys nothing and the default stays. A client that may not open a second connection stalls at the limit instead, which is one more reason to use the multiplexed stream. If a reconnect still fails with ENHANCE_YOUR_CALM or ResourceExhausted, look at what sits between the client and the kernel (a proxy or ingress with its own stream or rate limits) and at the registration concurrency of the silo; the numbers above are reproducible with --client-streams in the kernel benchmarks.
Removing observers no client has used
Section titled “Removing observers no client has used”When you rename or delete a reactor or reducer in application code, the observer it registered stays in Chronicle: its definition, its state in every namespace, its failed partitions, jobs and reminders. Chronicle can remove such an observer once no client has been subscribed to it for unseenRemovalAfter. This is off by default. Nothing is ever removed unless you set unseenRemovalEnabled to true; the period is seven days, which is the recommended one, and you only change unseenRemovalAfter to pick another.
{ "observers": { "unseenRemovalEnabled": true }}“Seen” means a client held a subscription to the observer. Chronicle records the time when a client subscribes and when the last client unsubscribes or disconnects, and refreshes it at most once an hour while a client stays subscribed. An observer subscribed for months is therefore never mistaken for an unseen one. The time is recorded whether or not the removal is on, so turning it on later does not start every clock from zero.
While the removal is off the sweep does nothing: it reads no storage and removes nothing. When it is on, the sweep runs on every silo, once per unseenRemovalSweepInterval. It finds candidates by reading storage, without activating observers, in batches of unseenRemovalBatchSize. It is safe to run on several silos at once: a candidate that two silos reach in the same instant is removed once, though both may log it and count it.
What is removed and what is not:
- Chronicle removes the observer’s definition, its state in every namespace, its failed partitions, handled counts, in-flight events, jobs and reminders, the same records as the
RemoveObservercommand. - A reducer’s read model data is not deleted.
- Only reactors and reducers declared by clients are removed. Projections, webhooks, event store subscriptions and kernel observers never are.
- An observer is never removed while a client is subscribed to it, while it is replaying, catching up or quarantined, while it has failed partitions or unfinished jobs, or when a client has been seen in any namespace within the period.
- Each removal is logged at
Informationlevel with the event store, namespace and observer id, and counted by thechronicle.observers.unseen_removedmetric.
An observer that has no recorded time, for example one created before the kernel recorded it, is not removed on the first sweep after you turn the removal on: the sweep records the current time as its clock start, and the observer is removed only after a full unseenRemovalAfter from then. Upgrading to a release with this setting therefore removes nothing, and turning it on removes nothing for the first period for observers without a recorded time. During a rolling upgrade, older silos do not record the time; a subscribed observer is never removed because of that, and the new silo records the time when it finds the observer subscribed. These are server-level settings and cannot be overridden per observer.
Registration concurrency
Section titled “Registration concurrency”maxConcurrentRegistrations limits registration work from gRPC reactors and reducers together on each silo. It defaults to 16, so a client that registers thousands of observers at once is admitted gradually instead of overwhelming the observers it subscribes. Values below 1 disable the gate: no semaphore is created and registration does not wait. Excess registrations wait before their first grain or read-model lookup, and waiting ends if the client disconnects.
A permit covers the registration lookups and subscription, not the lifetime of the connection. Once registration succeeds or fails, the permit is released. A disconnect cancels a queued registration; work already in flight retains its permit until it finishes. Reconnecting clients acquire a new permit. When subscribing times out because the observer is busy, the registration gives its permit back and queues for a new one before it asks again, so a busy observer does not keep other registrations out for every attempt it makes. Event append, observer delivery and subscription maintenance do not acquire permits. This is a per-silo limit, not a cluster-wide limit, and is independent of maxConcurrentPartitions.
Set it through JSON as shown above, or with Cratis__Chronicle__Observers__MaxConcurrentRegistrations as an environment variable.
Subscription concurrency
Section titled “Subscription concurrency”maxConcurrentSubscriptions limits how many projection subscriptions and failed-partition recovery batches run at once on each silo. The limit is shared by every event store on the silo, so a cold start with many event stores does not subscribe and recover more at once than a silo with one.
It defaults to 0, which selects the limit from the machine: two per processor, at least 4 and at most 16. A 2-core pod gets 4 and a 4-core pod gets 8. Values below 1 select this automatic limit. Raise it only when storage can serve more concurrent work, because extra work beyond what storage can serve waits in its connection pool instead.
Projection subscriptions wait for a free slot. Recovery batches together use at most half of the slots, and always at least one, so the rest stay free for projection subscriptions however long a recovery takes. A recovery batch does not wait for a slot; it tries again after a randomized delay of 0.5 to 1.5 seconds, so recoveries yield to subscriptions while a silo starts and do not all retry at the same moment.
Set it through JSON as shown above, or with Cratis__Chronicle__Observers__MaxConcurrentSubscriptions as an environment variable.
Per-observer retry overrides
Section titled “Per-observer retry overrides”You can override the failed-partition retry settings for a single observer. Add an observerRetryOverrides section next to observers in chronicle.json, keyed by the full observer key <observer id>#<event store>#<namespace>#<event sequence id>:
{ "observerRetryOverrides": { "d2a138a2-6ca5-4bff-8a2f-ffd8534cc80e#my-store#Default#event-log": { "maxRetryAttempts": 3, "backoffDelay": 5, "exponentialBackoffDelayFactor": 1.5, "maximumBackoffDelay": 120 } }}| Property | Type | Description |
|---|---|---|
| maxRetryAttempts | number | Maximum retry attempts for this observer’s failed partitions (0 = infinite) |
| backoffDelay | number | Initial backoff delay in seconds. Must be greater than 0 |
| exponentialBackoffDelayFactor | number | Exponential backoff multiplier. Must be a finite number of at least 1 |
| maximumBackoffDelay | number | Maximum backoff delay in seconds. Must be greater than 0 |
A property you leave out inherits its value from the global observers section, and every other observer setting always comes from that section.
The full key must match exactly, including case. There are no wildcards, and the observer id alone does not match. An entry that matches no observer is ignored without a warning. You find the observer ids on the Workbench Observers page or with cratis chronicle observers list.
The Kernel validates the entries at startup and refuses to start when one is invalid: the key must have four parts, maxRetryAttempts cannot be negative, backoffDelay and maximumBackoffDelay must be greater than 0, and exponentialBackoffDelayFactor must be finite and at least 1. The global observers values are not validated by this.
You can also set a value with an environment variable, which takes precedence over chronicle.json:
Cratis__Chronicle__ObserverRetryOverrides__<key>__MaxRetryAttempts=3Some shells and orchestrators reject # in variable names. Use chronicle.json then.
The values are copied into the configuration when the Kernel starts, so restart the Kernel to change them. Retry reminders that are already scheduled keep their time, and new values apply from the next scheduled retry or recovery. Lowering maxRetryAttempts does not park partitions that are already failing. A delay that would exceed maximumBackoffDelay, including one that results from a very large factor or attempt count, uses maximumBackoffDelay.
Webhooks ignore these overrides. They use their own webhooks.retry settings, see Delivery retry policy. Alerts for webhook observers use the webhook retry settings too.
Definition evolution
Section titled “Definition evolution”Chronicle compares every newly registered projection and reducer definition with its stored definition. It then chooses the minimum operation it can prove correct:
| Classification | Behavior |
|---|---|
| No action | A newly consumed event type has no historical events, so existing read models cannot change |
| Partial replay | A reducer adds event types that occur only after its previously consumed events for each affected event source. Chronicle applies only those new event types to the affected event sources |
| Full replay | A projection adds event types with historical events, or the mapping, reducer implementation fingerprint, filter, key, join, child structure, or another order-dependent part changed. Chronicle rebuilds the complete observer |
Automatic applies every classification. PartialOnly applies no-action and partial plans, but creates a replay recommendation when a full replay is required. Manual creates a recommendation for both partial and full plans. No-action plans never create recommendations because history cannot be affected.
Projection definition changes requiring historical backfill always use full replay, even for independent property mappings. Replaying selected historical events into the live container can reject writes behind its watermark or apply contributions twice. With PartialOnly or Manual, these changes therefore create a full-replay recommendation. Explicit partition replay is unchanged.
Reducer registrations include a fingerprint of their reducer methods. Changing reducer code therefore triggers classification even when its event-type subscription is unchanged. Reducer methods are imperative, so Chronicle only chooses a partial reducer replay when history proves every newly consumed event follows all previously consumed events within its event source. Interleaved history falls back to full replay.
Subscriber timeout
Section titled “Subscriber timeout”Every path that hands events to an observer’s subscriber — live delivery, catch-up and replay — waits at most
subscriberTimeout seconds for an answer. When it elapses, the batch is recorded as a failed partition of kind
Timeout and the partition retries with the usual backoff.
Giving up abandons the wait, not the work. For gRPC reactors and reducers, Chronicle holds the subscriber turn open after the timeout and fences that partition before recovery can send another batch.
The setting is independent of clustering.responseTimeout. Subscriber calls carry their own Orleans response
timeout of 1 hour, so a subscriberTimeout of, for example, 600 waits the full 10 minutes during catch-up,
replay and partition recovery without raising the response timeout for every other call in the cluster. When a
subscriber call does hit that 1-hour ceiling, the failure says so (The Orleans response timeout fired after ...)
instead of naming the configured subscriber timeout.
Set it to 0 to wait indefinitely during catch-up and replay. This also disables abandoned-delivery fencing. Both
0 and values above one hour are bounded by the 1-hour ceiling, and Chronicle logs a warning at startup when that
applies.
Live delivery still bounds its wait to five seconds below the effective Orleans response timeout (the larger of
its response and system-response timeouts), including when subscriberTimeout is 0, because the observer has to
record the result before its own call times out. A shorter positive subscriber timeout remains unchanged. If the
response timeout is at most five seconds, the live wait is reduced to a minimal positive duration rather than
becoming indefinite.
Live batches exceeding liveDeliveryBudget (default 100 events) are deferred to a partition catch-up job
before calling the subscriber. The job starts at the batch’s first unhandled event; the live position does not
advance merely because the batch was deferred. A batch at the limit is delivered live. Set the budget to 0
or less to disable this handoff. This setting does not limit catch-up or replay batch sizes.
Bounded subscriber calls
Section titled “Bounded subscriber calls”Catch-up, replay and partition recovery read events from storage in batches whose size the storage decides, and a
MongoDB cursor batch can hold thousands of events. A gRPC client or webhook subscriber gets them at most
maxEventsPerSubscriberCall at a time. Each answered call is checkpointed before the next is sent, so a long
partition advances call by call, and subscriberTimeout only has to cover the work behind one bounded call.
Kernel-owned subscribers, such as projections, keep the storage batches they are tuned for.
Every batch sent to a gRPC client also says how long the kernel waits for its result (DeliverWithinMilliseconds,
counted from when the client receives it). A client that only gets to the batch after that time can answer it as
failed right away instead of doing work the kernel has already given up on.
Page bounds
Section titled “Page bounds”A client reactor or reducer that receives pages can declare how big a page may be: the .NET client takes the bounds
from [BatchSize] (see reactor batches and
reducer batches). The kernel honors them on every path, live,
catch-up, replay and retry:
| Declared | Kernel maximum | Page bound |
|---|---|---|
Events above 0 |
maxEventsPerPage |
The declared number, capped by the maximum |
Events 0 |
maxEventsPerPage |
The maximum |
Bytes above 0 |
maxBytesPerSubscriberCall |
The declared number, capped by the maximum |
Bytes 0 |
maxBytesPerSubscriberCall |
The maximum |
A maximum of 0 or less means the kernel sets none, so the declared bound applies as it is.
- An event’s size is the UTF-8 length of its JSON content. A reducer page also holds the state of each partition in it, so that state counts toward the byte bound once per page, estimated from the size it had when it was last reduced. Only the states of recently reduced partitions count: each silo remembers the sizes of about 10 000 partitions across all its reducers and namespaces, and forgets those not reduced for the longest. A state the kernel has not seen since it started, or has forgotten, does not count toward the page that reads it, only toward the pages after it.
- The byte bound covers content, not the whole message. The envelope around it, event metadata, partition keys and a reducer’s states as sent, comes on top. The default of 4 MiB equals the default receive limit of gRPC clients such as grpc-js and grpc-java, so a client that keeps that limit should declare a smaller bound or raise its receive limit.
- An event larger than the byte bound is sent alone in its own page, so it never stalls its partition.
- A page larger than the bounds is sent as several pages, one after another. A partition that spans them stops at the first page it fails or is deferred in; its later events are delivered again once the partition is recovered, and events it handled in earlier pages stay handled. A reducer reduces each page from the state the page before it wrote.
- The pages of one delivery share its
subscriberTimeout. When it passes part-way, the page answered late is discarded and no later page is sent; what earlier pages handled stays handled, and the rest is delivered again. - The kernel never makes a page larger than it would otherwise send: during catch-up, replay and retry that is
maxEventsPerSubscriberCallevents, and live it is what has been appended and waiting, up toliveDeliveryBudget. RaisemaxEventsPerSubscriberCallto let a declared bound above 100 take effect during catch-up, replay and retry. - The declared delay (
MaxDelayMilliseconds) is accepted but not applied yet: a live page holds what is already waiting. - A client that does not receive pages is delivered one partition at a time, bounded only by
maxEventsPerSubscriberCallduring catch-up, replay and retry.
Abandoned client deliveries
Section titled “Abandoned client deliveries”abandonedDeliveryHold defaults to 300 seconds after the delivery deadline. A positive value smaller than
subscriberTimeout uses the subscriber timeout instead. Set it to 0 or less to restore immediate, unfenced
recovery. Kernel-owned subscribers and webhooks keep their existing behavior.
Live delivery records the timeout without waiting inline. Retry, catch-up and replay wait for a barrier on the original subscriber activation, not a replacement client. Superseding a connected client or removing its target from the subscription does not prove its work ended. Unaffected partitions can continue. A failed or timed-out barrier call — including an unavailable original silo — keeps the fence until the maximum hold unless a later barrier succeeds. Chronicle never treats a placement exception as proof that the old activation drained.
Each dispatch carries optional deadlines in its internal subscriber context; no gRPC contract or client upgrade
is required. A queued delivery that arrives after its deadline is rejected before reaching the client mediator.
Results received after the deadline are discarded, and a late reducer result cannot write to the sink. Pending
turns end when the client answers, disconnects, or the hold expires. Timeout failure attempts persist the original
target identity and release deadline. After reactivation, an old or unparseable identity is held conservatively for
abandonedDeliveryHold from the failure time; recovery never substitutes the current subscription target.
Use the abandoned-delivery logs and metrics to tell a slow client from a failed one before reducing the hold.
What a failed partition says went wrong
Section titled “What a failed partition says went wrong”Every attempt recorded against a failed partition carries a kind, so an observer that is wrong can be told apart from one that was only waiting on a busy kernel:
| Kind | Meaning |
|---|---|
Handling |
The subscriber failed while handling the events. This is the failure that means something is wrong |
Timeout |
The call to the subscriber did not come back in time. The events were never rejected — the kernel ran out of patience waiting, which says the system was congested |
Disconnected |
The subscriber was gone by the time the events reached it |
Unknown |
Nothing classified the failure. Every attempt recorded before failures carried a kind reads back as this |
A partition whose last attempt is a Timeout does not count toward the quarantine thresholds above.
Quarantining stops retries and needs an operator to undo, which is the right answer for an observer
that is wrong and the wrong answer for one waiting on congestion that will clear on its own.
Webhook retries use their own webhooks.retry settings, with bounded ±20% jitter and a persisted
RetryBackoff deadline. maxRetryAttempts: 0 still means unlimited retries. For webhooks, the
observer-quarantine thresholds count parked non-timeout partitions, not transient partitions still
waiting for retry. Receiver Retry-After and open-circuit deferrals consume no retry attempts.
See Webhook delivery policy.
Ending quarantine
Section titled “Ending quarantine”An observer’s quarantine ends only through one of these actions:
- An operator clears it with
cratis chronicle observers clear-quarantine, from the Workbench, or through the corresponding clear-quarantine API. - The observer receives a fresh subscription from its client or from the Kernel, as listed in the table below. The Kernel re-establishing an event store subscription or reconciling a webhook at startup does not end quarantine.
- For an eligible webhook delivery failure, an automatic recovery probe succeeds and durably records progress.
What can establish a fresh subscription depends on the observer:
| Observer | Subscribed again |
|---|---|
| Reactors and reducers of an application | When an instance of the application’s client connects or reconnects, including after a Kernel restart, and when the client registers a changed definition |
| Projections | When the Kernel starts, when a client registers a changed definition, and when a namespace is added |
| Webhooks | When a client registers a new or changed webhook, when a webhook is added or edited (target URL, headers, authorization or event types), and when a namespace is added |
| Event store subscriptions | When the Kernel starts, when a namespace is added, and by the check the Kernel runs every minute, which subscribes one again if it is no longer subscribed or its event types changed. None of these ends quarantine; clear it with cratis chronicle observers clear-quarantine or from the Workbench |
| The Kernel’s own reactors and pattern capture | When the Kernel starts, when an event store is added, and when a namespace that already holds events is added. Pattern capture is also subscribed again when a client registers new event types |
These actions do not end quarantine:
- Watchdog ticks, including checks for missing jobs and stranded catch-up preparation.
- Catch-up or replay completion, including completion for individual partitions.
- Unsubscription or observer grain deactivation and reactivation.
- Webhook startup reconciliation, which preserves quarantine and the durable recovery probe.
- Automatic event-store-subscription reconciliation, whether triggered by startup, manager reactivation, source availability, namespace notifications, definition reconciliation, or the minute check.
A Kernel restart ends quarantine only for observers that receive a fresh subscription as listed above; webhook startup reconciliation preserves quarantine, and event store subscriptions remain quarantined until an operator clears them.
Completing catch-up or replay still persists progress and clears completed-work markers without resuming the
observer. Clearing quarantine then re-evaluates remaining work from the recorded position. For a subscribed
observer, clearing resumes paused non-replay jobs, including catch-up jobs, and retries failed partitions that
are not individually quarantined, subject to the configured retry limits. Recovery can quarantine the observer
again if the underlying problem remains. If that recovery fails, for example because the job store is briefly
unavailable, the observer is left Disconnected rather than Quarantined. The watchdog retries the recovery
on each check, and after maxCatchupRecoveryAttempts failed retries in a row it quarantines the observer again so
you can see it and clear it once the cause is fixed. An observer without a subscription follows the same routing as
activation, including how pending replay is handled, and cannot deliver events until a subscription is established.
Quarantine does not cancel already-running catch-up or replay jobs, and partition completion can still start
required partition continuation work without ending the observer’s quarantine.
Clearing observer quarantine does not clear failed partitions or their separate quarantine status. Failed partitions stay recorded until they recover or are cleared.
Scaled-out clients
Section titled “Scaled-out clients”When multiple instances of the same client application connect, its reactors and reducers all
subscribe to the same observer. Chronicle fans event delivery out across the instances using the
configured fanOutStrategy. If an instance disconnects, it is removed immediately and its
partitions are redistributed to the remaining instances - the observer only unsubscribes when the
last instance is gone.
Concurrent client versions
Section titled “Concurrent client versions”During a rolling deployment, two versions of an application can be connected at once and register the same observer with different event types. The last registration wins: the observer follows the definition of the client that registered last, and the earlier client stops receiving events for it.
When the client that won leaves, Chronicle hands the observer over to the most recently superseded client that is still connected, exactly as if that client had registered again. The hand-over happens when the connection is dropped and when the watchdog finds the client gone. It never ends a quarantine and never reactivates a retired observer. When no earlier client remains, the observer unsubscribes.
When a connection is dropped, Chronicle tells only the observers that connection subscribed, each with the exact connection identifier, without waiting for the watchdog. Telling an observer is best effort and runs outside the connection registry, so a notification that is lost, late or repeated is harmless: the watchdog still finds the client gone on its next check. During a rolling upgrade, or if recording the observer for its connection fails, the subscription still stands and takeover falls back to the watchdog. Observers served by a webhook are never affected by a client connection being dropped.
Events of types that only the departed client handled are not replayed to the client that takes over; that belongs to the planned union of the event types of concurrent clients. Serving both sets of event types at the same time is not supported yet.