What is a streaming Data Clean Room and why it differs from traditional batch
A Data Clean Room (DCR) is a secure environment where two or more partners match their data without ever exposing it directly to each other. Historically, this matching happened in batch: weekly or daily file aggregation, offline processing, results available with a 24- to 48-hour delay. With streaming data, the paradigm shifts radically. Instead of waiting for the next batch, every event (impression, click, conversion, visit) is processed continuously, enabling marketing decisions in milliseconds. This approach opens the door to use cases impossible in batch: real-time bid adjustment during an impression, dynamic personalization of a web page at load time, instant retargeting the moment a user leaves your site.
Why real time in a DCR is becoming essential for advertisers
Market expectations have changed. Previously, a daily audience insight was enough: "These 50,000 users saw your ad yesterday, match them with our buyers and set aside budget for the coming weeks." Today, advertisers ask: "This user is browsing my page right now — is there a match with your premium audience at this exact moment?" The reason is simple: a decision delayed by an hour can mean an abandoned cart, a lost conversion, or poor budget allocation. Programmatic advertising platforms (DV360, The Trade Desk) now support real-time integrations. Retail media teams fused with martech demand instant synchronization between physical store data and online pricing or promotion decisions. A retailer can adjust a product's price on its site based on detected inventory and audience data enriched by a martech partner — but only if that enrichment arrives in real time.
Architecture models: from batch to streaming
Traditional batch approach (still relevant for some cases)
Two teams exchange CSV or Parquet files via secure SFTP or a protected cloud bucket. The Data Clean Room performs join, deduplication, and filtering operations once a day. Results are stored, then downloaded by each partner. Advantages: simplicity, low infrastructure costs, easy auditing. Major drawback: latency incompatible with real-time decisions.
Native streaming approach
Each partner sends its events (or an event digest) continuously to the DCR, often via a REST API, gRPC, or a message broker (Kafka, AWS Kinesis). The DCR maintains reference tables in memory or in an ultra-fast columnar database (DuckDB, ClickHouse). The moment an event arrives, the DCR can compute a match, apply security rules (hashing, removal of sensitive fields), and immediately return a result or signal to the partner. Advantages: sub-100ms latency possible, maximum freshness. Drawbacks: complex infrastructure, significant compute costs, difficult spike management.
Hybrid approach (the most common in practice)
A daily or hourly batch serves as the "reference": it creates the segments, the audiences to match, the matching rules. In parallel, lightweight streaming processes events continuously, but only against already-computed segments. Concrete example: you compute in batch (each night) the list of "high-value customers" (HVC). During the day, each user event is tested against this pre-computed list in a few milliseconds. Deep insights (clustering, grouping) stay in batch; tactical decisions (simple match, enrichment) run in streaming.
Technical challenges specific to streaming in a Data Clean Room
1. Freshness vs. security
In batch, data can be heavily aggregated and anonymized before sharing: "100 users match, without listing them." In streaming, if you return a response in 50ms, there's a risk that this response is too granular, revealing individual behavioral patterns. Very fresh data can leave traces of a specific user (example: this conversion event arrives at 2:23 PM from this partner, it can only be this unique user). The solution: add statistical noise (differential privacy), limit granularity (return aggregated signals even in streaming), or use deterministic hashes that are not reversible.
2. Clock synchronization and causality
When two systems exchange events continuously, order becomes critical. The user clicks on partner A's ad, then visits partner B's site 2 seconds later. If the clocks of both servers aren't synchronized (even by just 5 seconds), the order can be reversed, and the chain of causality broken. Standard solution: use NTP (Network Time Protocol) to synchronize all clocks; add microsecond timestamps to events; introduce a small tolerance window (for example, accept events that arrive up to 10 seconds late and reintegrate them in order).
3. Handling late arrivals and deduplication
In batch, each user and each event is processed only once. In streaming, an event can arrive multiple times (API retry), or very late (offline user, resynchronization on reconnection). The DCR must deduplicate events over a sliding window: "over the last 24 hours, I ignore duplicates based on [user_id, event_type, timestamp]." This requires an efficient in-memory data structure (for example, a Bloom filter or a high-performance Cassandra database).
4. Time windows for aggregations
In batch, an audience is frozen: it's the list computed yesterday. In streaming, an audience is a continuous flow. How do you define "the audience to match against right now"? Should you match against the last 1,000 events from the past 5 minutes? The 50,000 from the last hour? Common practice: matching requests specify a time window. An API call can say "Does this user match my partner's active users in the last 30 seconds?" Short windows (seconds, minutes) enable very fresh consistency; long windows (hours) offer more matching surface but reduce freshness.
5. Performance and scalability under load
An event arrives every millisecond, from tens of thousands of sources. A DCR must support spikes (for example, Black Friday with 10x normal traffic). Classic solutions (relational SQL databases) collapse. Solutions used in practice:
- Real-time columnar databases (ClickHouse, Druid): optimized for analytical queries on billions of rows in a few hundred milliseconds.
- In-memory stores (Redis, Memcached): for hot data (segments, audiences, recent hashes).
- Message brokers with partitioning (Kafka, AWS Kinesis): distribute events by user_id or partner_id to parallelize matching.
- Computed fields and pre-aggregations: instead of computing a metric on every request, keep it updated incrementally (example: a sliding window of the number of conversions over the last 5 minutes, updated on each event).
6. Infrastructure costs
Streaming is resource-hungry. Where a daily batch might cost maybe $100/month in cloud, continuous streaming can cost $1,000–5,000/month depending on volume and complexity. Costs come from: event ingestion (Kinesis, Pub/Sub), temporary storage (buffers, caches), matching compute (vCPU, memory), and data output (API, webhooks). You need to size correctly: over-provisioning = waste; under-provisioning = data loss or unacceptable latency. A common approach: start with "light" streaming (50% of actual throughput, simple segmentation) and scale progressively once ROI is proven.
Real-world streaming use cases in a Data Clean Room
Secure Real-Time Bidding (RTB)
A programmatic ad network must decide in 100ms whether to buy an impression for a given user. Traditionally, it queries an external data broker, which poses risks of leaking private data. With a streaming DCR, the advertiser pre-sends its segments into the DCR (list of users interested in running shoes, updated every 5 minutes). When an impression comes in, the SSP sends a user hash to the DCR, which responds in <50ms: "Match" or "No match," without ever revealing either the user's identity or the segment's composition. The advertiser can then immediately decide whether to bid.
Dynamic pricing and cross-channel promotions
An e-commerce merchant tracks its inventory in real time and wants to synchronize prices with a martech partner's audience data. Example: "If this user belongs to my loyal customer audience (martech data, shared via streaming DCR) AND my inventory of this product is low (internal data), apply a 10% discount to encourage purchase." The DCR receives the user arrival event, matches it against the loyal customer list (streaming, updated hourly), and returns an enriched flag: {"user_id_hash": "abc123", "is_loyal_customer": true}. The e-commerce site uses this flag to adjust the price at load time.
Instant retargeting
A user leaves your site after 10 seconds without buying. Previously, you waited until the next day to create a retargeting list. With streaming DCR: as soon as a "page_exit" or "cart_abandon" event arrives, the DCR immediately forwards it to the partner ad platform. That platform adds the user (hashed) to a retargeting segment, and its ads appear 5 minutes later on its partners' sites. Zero delay, direct conversion.
Attribution and agile funnel
The CMO wants to understand in real time: "Which martech partner generates the fastest conversions?" In batch, the report is generated after 24h. With streaming, each conversion fed by an event from partner A, B, or C is logged immediately in the DCR, which accumulates the counters. The CMO's dashboard displays at any moment: "Today, partner A = 320 convs at an average of 45 min post-click, partner B = 280 convs in 52 min." Budget decisions can be rerouted within the hour, not within the week.
Practical implementation: steps to move from batch to streaming
Step 1: Assess your current data flow
Before reworking the architecture, understand: what volumes arrive (number of events/day)? What existing latencies are acceptable? Where exactly do you need real time (bidding, pricing, content?) vs. where is batch still sufficient (reports, analytics)? Create a matrix: for each use case, columns "current latency," "required latency," "batch cost," "estimated streaming cost."
Step 2: Choose a managed streaming platform
If you have limited DevOps resources, prefer a managed cloud service: AWS Kinesis, Google Cloud Pub/Sub, Azure Event Hubs. If you have a mature infrastructure team and custom needs, Kafka can be more flexible (and less expensive at very large scale). Key decision: do batch and streaming coexist, or do you completely replace batch?
Step 3: Prototype a simple matching request
Don't start by processing all events. Select a simple segment (for example, 100k users) and a simple request (does this user exist in this segment?). Implement the end-to-end chain: user sends event → DCR receives → in-memory lookup → responds. Measure actual latency. Often, 90% of the work comes from 10% of the complexity (legacy integration, security audit, error handling).
Step 4: Secure and audit
Streaming must not weaken batch security. Make sure that:
- Every event is encrypted in transit (TLS 1.3).
- Pre-computed data (segments) never leaves in clear text: deterministic hashing immediately at the entry point.
- Logs of all matches (who queried what, when) are retained and audited.
- A request reveals only the minimum: a boolean (match / no-match) or a score (0-100), never a list of users.
Step 5: Size and scale
Once the prototype is validated, estimate peaks. Allocate 3–4x average capacity (for peaks). Configure auto-scaling: increase streaming workers if latency exceeds 500ms, decrease if it drops below 100ms. Monitor continuously: latency percentile 50/95/99, event loss rate, cost per processed event.
Common pitfalls and how to avoid them
Pitfall 1: Overestimating the need for real time
Not everything needs 50ms. Retargeting with a 2-hour delay often converts just as well as at 2 seconds (behavioral context study). Before investing in costly streaming, measure the real impact of a latency reduction. Sometimes, more frequent batch (every 15 minutes instead of daily) satisfies the business at 10% of the cost.
Pitfall 2: Neglecting data quality at the source
Streaming propagates errors faster. An event with an erroneous timestamp, a null user_id, or an inconsistent format can paralyze your pipeline. Implement a schema registry (Apache Avro, Protobuf) and validate each event before entry. Rejections (invalid data) must be logged and alerted, not silently deleted.
Pitfall 3: Ignoring time windows
Without a window, a user always "matches" (they visited once in 2018). With a clear window ("active in the last 7 days"), the match is relevant. Document each request: which window does it use? Can it be adjusted by the client?
Pitfall 4: Forgetting load tests
Streaming works perfectly at 100 req/sec, then collapses at 1,000. Test with at least 2–3x your expected peak. Tools: Apache JMeter, Locust, or Kubernetes scripts to simulate thousands of clients.
Pitfall 5: Uncontrolled infrastructure costs
Streaming can quickly eat through your budget. Set up alerts: if daily costs rise by more than 20%, something is wrong (memory leak, infinite loop). Size instances just right, no more.
Security and compliance in streaming DCR
The GDPR and other regulations (CCPA, LGPD) make no exception for streaming. Key points:
- Consent: a user must consent to sharing even if it's in real time. Consent doesn't change with latency.
- Minimization: share as little information as possible. A user ID hash = ok. A name and email address = dangerous.
- Audit trail: log every query. If a partner abuses the DCR, you must be able to prove it.
- Right to erasure: if a user requests deletion, it must also apply to streaming data. A batch process is sufficient (hourly deletion of the affected events); there's no need to interrupt live streaming.
Roadmap: progressive streaming adoption
Phase 1 (Months 1–2): Optimized batch, but more frequent (3x per day instead of 1x). Costs +15%, latency divided by 3. Simple, low-risk.
Phase 2 (Months 3–4): Streaming pilot on a low-volume segment (a single partner, a single use case). PoC infrastructure, not production.
Phase 3 (Months 5–6): Streaming in production on 1–2 partners. Batch remains the backbone, streaming enriches with tactical decisions.
Phase 4 (Months 7+): Progressive expansion. Batch can be reduced (moved to 1x/day or even 1x/week for analytics); streaming becomes primary for decisions.
Conclusion
Streaming data in a Data Clean Room represents a qualitative leap for data-driven marketing. Where batch brought reliability and simplicity, streaming brings agility and responsiveness. But this power demands more complex infrastructure, constant monitoring, and mastery of technical challenges that are often underestimated. The advertisers who succeed are those who: (1) honestly assess whether real time is truly necessary for their use case, (2) start with lightweight pilots, (3) invest in observability and security from the start, and (4) keep batch as a safety net during the transition. The future of data sharing isn't 100% streaming or 100% batch — it's an intelligent hybrid, where each approach serves its role.