Designing Idempotent Multi-Tenant Queues Without Redis Lock Contention
OP
Owen Pritchard
Staff Distributed Systems Engineer
When a single B2B customer triggers a batch import of 500,000 invoices, naive FIFO queues let that one tenant saturate shared worker pools while interactive signups and password resets stall behind them.
Fair-Share Virtual Lanes
Instead of provisioning separate physical Redis clusters per tenant, LaunchCore hashes each dispatch onto a lightweight virtual lane keyed by tenantId and schedules workers via weighted deficit round-robin.
dispatch-idempotent.ts
await client.workflows.dispatch('billing.charge', {
tenantId: invoice.accountId,
idempotencyKey: `charge_${invoice.id}_v1`,
concurrencyLane: invoice.accountId,
});
Key Takeaway
Combining an explicit idempotency key with tenant-scoped concurrency lanes eliminates both duplicate side effects and noisy-neighbor latency spikes.