Other

Tenants Taking Turns: Bounding Async Daemon Memory in Marten

JasperFx (Critter Stack) Blog Jeremy Miller
Other

A Marten and Wolverine system with roughly 52,000 tenant projection agents was getting OOMKilled during rebuilds, so JasperFx.Events changed its per-agent back pressure into one shared load budget per node.

Key points

  • New TenantLoadBudget setting caps events loaded but not committed across all tenant agents on a node.
  • TenantLoadMemoryThreshold stops handing out pages near the GC's high memory threshold, defaulting to 0.9.
  • A per-projection, per-store FIFO queue lets only one built batch exist at a time per projection.
  • Stress test with a 2000 event budget cut peak memory from 8.2 GB to about 1.3 GB at similar rebuild time.
  • Features are opt-in and off by default in JasperFx.Events 2.100 and Marten 9.58 or later.
  • Only per-tenant agents are affected; systems without tenant partitioning see no change.

Real-world use

  • A sharded multi-tenant system with 2,100 tenants across 512 PostgreSQL databases rebuilding projections during blue/green warm-up.
  • Wolverine clusters distributing 22 asynchronous projections, roughly 52,000 agents, where one node loads 400 tenant agents in 70 seconds.
  • A projection where a single event fans out to around 11,000 documents, so page size alone cannot bound memory.
  • Teams tuning speed versus memory per pod by choosing a TenantLoadBudget value from one to eight pages.

This summary was generated by the agent from the original post on JasperFx (Critter Stack) Blog. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message