Skip to content

Operate and tune Orleans streams

Tune from measured lag, throughput, failures, and memory pressure. Provider defaults are starting points, not universal production settings.

Persistent providers pull events into silo-side caches and deliver them to subscriptions. A consumer applies backpressure by not completing OnNextAsync until it has accepted responsibility for the item. Slow consumers can therefore increase retained queue data, cache pressure, and end-to-end lag.

Keep consumer turns bounded:

  • Persist required state and complete promptly.
  • Move independent long-running work behind an explicitly modeled handoff.
  • Avoid synchronous blocking and unbounded parallel work.
  • Scale by choosing enough provider queues or partitions and by distributing stream keys. One hot stream targeting one stateful grain remains limited by that grain’s processing rate.

Backpressure on the consumer side doesn’t imply producer completion. OnNextAsync on the producer reports provider acceptance, not that downstream consumers caught up.

Persistent providers expose common configuration through their stream configurators:

Provider-specific controls matter as much as common controls: QueueNames, Event Hubs partitions and cache-pressure settings, Redis ReadCount and retention, NATS BatchSize and PartitionCount, and ADO.NET visibility, expiry, and dead-letter settings.

Change one bottleneck at a time. More queues can increase parallelism but also broker cost, polling load, cache memory, and rebalance work. Reducing polling delay can lower latency while increasing empty reads.

Export Orleans meters and correlate them with broker metrics and application event IDs. Useful Orleans instruments include:

SignalInstruments
Active topologyorleans-streams-pubsub-producers, orleans-streams-pubsub-consumers, orleans-streams-persistent-stream-pulling-agents
Throughputorleans-streams-persistent-stream-messages-read, orleans-streams-persistent-stream-messages-sent, orleans-streams-queue-messages-received
Queue healthorleans-streams-queue-read-failures, orleans-streams-queue-read-exceptions, orleans-streams-queue-oldest-message-enqueue-age
Cache healthorleans-streams-queue-cache-size, orleans-streams-queue-cache-length, orleans-streams-queue-cache-pressure, orleans-streams-queue-cache-under-pressure
Memoryorleans-streams-block-pool-total-memory, orleans-streams-block-pool-available-memory

Alert on sustained oldest-message age, cache pressure, read failures, repeated consumer exceptions, dead-letter growth, and a mismatch between expected and active subscription counts. Broker-side backlog and retention alarms remain necessary because Orleans can only report what its adapters observe.

For the components behind these signals, see Orleans streams implementation.