Instacart needed to extend its Marketplace-grade marketing automation to the white-label Storefront Pro platform.
Without isolation, the system risked cross-retailer data leaks, API rate-limit bottlenecks and high manual overhead.
The team solved it by: 👉 Provision a dedicated third-party workspace for each retailer to guarantee isolation. 👉 Batch individual customer events into groups of up to 50 before sending to the CRM service. 👉 Run the CRM service as a Rails engine with Sidekiq workers for horizontal scaling and idempotent delivery.
The parts that matter: 1️⃣ Campaigns Engine - Evaluates audience, assigns experiments and emits one event per customer 2️⃣ Stream Consumer & Batching Layer - Consumes events, groups up to 50 users, forwards batches to CRM
The pipeline now handles campaigns of hundreds of thousands to millions of messages with reduced API pressure and reliable delivery.
Batching adds latency between event emission and actual send because messages wait to fill a batch. It also requires a more complex streaming layer and careful handling of partial failures within a batch. The team accepted this latency to gain throughput and stay within provider rate limits.
How do you balance batch size for throughput against latency requirements in your own multi-tenant messaging systems?