#Backend

Rebuilding Guardian: How Pinterest Upgraded Its Real-Time Abuse Platform to Modern Infrastructure…

Rebuilding Guardian: How Pinterest Upgraded Its Real-Time Abuse Platform to Modern Infrastructure…
01

Summary

How Pinterest Scales Real-Time Abuse Detection for Billions of Events Without Governance Chaos

Inside Guardian V2: Decoupling a Monolithic Rules Engine into a Modern Platform Powered by StarRocks, FlinkSQL, and Iceberg

Pinterest completely modernized Guardian, its real-time analytics and rules engine for Trust & Safety, into a modular V2 architecture. By separating query discovery, streaming processing, and historical replay into dedicated paths, Guardian V2 eliminated historical scaling bottlenecks while preserving an agile investigation-to-action workflow. This evolution provides a comprehensive blueprint for engineering teams building large-scale data and abuse mitigation platforms.

  • 01Decoupled monolithic processing into dedicated paths for real-time analytics (StarRocks), continuous evaluation (FlinkSQL), and historical replay (Iceberg)
  • 02Maintained a unified GSQL V2 query interface backed by an ANTLR4 Java translation service to keep analysts' workflow seamless
  • 03Optimized data plane with stream splitting and pruning, shrinking effective dataset column scale from O(20K) to O(K)
  • 04Achieved sub-second analytical query performance using StarRocks with Bloom filter indexes and Duplicate key tables
  • 05Unified live streaming execution and up to 30-day historical replay under declarative FlinkSQL jobs and the Pinterest Unified Driver foundation

RECOMMENDATION

Highly recommended for data infrastructure engineers, backend architects, and Trust & Safety tech leads who design real-time event processing platforms or migrate monolithic data pipelines to modern streaming engines.

The Problem

Pinterest's legacy Guardian V1 platform used a monolithic architecture to handle interactive querying, continuous stream evaluation, and backfill workflows, which led to severe scalability bottlenecks, reduced reliability, compliance risks, and high operational maintenance costs as traffic expanded.

The Solution

The team rebuilt the platform into Guardian V2 by decoupling real-time analytics, continuous signal generation, action evaluation, and historical replay into specialized paths. Key architectural decisions included maintaining a unified GSQL V2 translation layer, implementing stream splitting and pruning, adopting StarRocks for analytics, and leveraging FlinkSQL and Iceberg for stream processing and replay.

The Result

The new architecture reduced the indexed column scale from O(20K) to O(K), enabled sub-second query latencies for high-selectivity analytics, and significantly improved system reliability, scalability, data governance, and maintainability while retaining the fast loop from investigation to enforcement.

Trade-off

Shifting from a monolithic system to a decoupled architecture with StarRocks, FlinkSQL, and Iceberg increased overall architectural complexity and reliance on specialized central data platform components.

03

Key Concepts

Concept · 01

Stream Splitting and Pruning

A data plane technique that divides broad, highly sparse event streams into smaller, correlated event family streams while removing unneeded fields before ingestion.

  • Eliminated data sparsity across broad Trust & Safety event feeds.
  • Reduced the effective column scale from O(20K) to O(K), drastically optimizing downstream ingestion and evaluation resources.
Concept · 02

StarRocks

A modern distributed SQL query engine optimized for vectorized execution, columnar storage, and real-time analytical workloads over high-volume data streams.

  • Serves as Guardian V2's real-time analytics engine for investigating abuse patterns and testing hypothesis.
  • Utilizes Bloom filter indexes and Duplicate key tables to lower high-selectivity lookup latency to sub-second levels.
Concept · 03

FlinkSQL & Apache Iceberg Integration

An architecture combining continuous stream processing via FlinkSQL with open table format storage via Iceberg to unify live action evaluation and historical replay.

  • Executes identical declarative FlinkSQL queries over live Kafka streams and up to 30 days of historical Iceberg datasets.
  • Standardizes deployment and execution management through Pinterest's platform-wide Flink Unified Driver.