[Architecture Pattern] Billion-Scale Telemetry Ingestion on GCP (Pub/Sub, Bigtable, BigQuery, Valkey and GCS)

Hi GCP Community!
Sharing an architectural case study on designing high-throughput data ingestion pipelines operating at a scale of ~2 billion monthly events. This reference pattern focuses on balancing low-latency edge ingestion with cost-effective long-term storage using Cloud Pub/Sub, Cloud Bigtable SSD, Valkey and a GCS Parquet Lakehouse with BigQuery.

We were dealing with a global endpoint security and activity monitoring platform where millions of edge devices send continuous activity logs summing upto ~2 billion raw event payloads every month. While the average baseline of ~500–600 requests per second (RPS) is manageable, daily morning surges across timezones explode into regional peak bursts of 5,000 - 6,000 RPS, bombarding the API gateway with thousands of raw JSON payloads per second.

The system was choking during these surges because of how it was originally wired up.

First, the legacy state was a hybrid, cross-cloud setup:

  • Classification Compute lived on GCP (running inline rules, Vertex AI models, and making cross-border calls to a 3rd-party SaaS classifier in only a specific region).
  • The Operational Data Plane lived in Microsoft Azure (raw JSON logs dumped into Azure Table Storage, screenshots stored in Azure Blob Storage).

Second, the client agents on edge devices communicated using a tightly coupled, synchronous two-call HTTP REST protocol:

  1. Call 1: The device posted raw captured text and sat waiting on an open HTTP connection for an inline classification verdict.
  2. Call 2: If flagged, the device made a second synchronous request, packing a heavy, Base64-encoded screenshot inline inside the JSON payload over the network wire.

To achieve low-latency queries without secondary indexes, the legacy architecture dumped 100% of raw JSON captures into a single monolithic NoSQL table. Worse yet, without automated Time-to-Live (TTL) retention rules, cold logs sat on expensive SSD storage indefinitely. The dataset bloated to over 100+ TB, racking up a 5 figure monthly cloud storage bill just to store cold, un-alerted telemetry data.

Running this at a global scale meant that 100+ TB of storage bloat, in-memory Base64 decoding, and cross cloud round trips was keeping the system in a state of permanent firefighting.

To eliminate bottlenecks and safeguard edge availability, we consolidated our data plane natively on GCP by implementing five core architectural principles:

  • Pub/Sub Queues: Buffering raw traffic to smooth out spikes.
  • GCS Signed URLs: Offloading heavy media payloads directly from the app layer.
  • Dual-Table Bigtable Strategy: Stripping cold telemetry off expensive SSDs to optimize storage costs.
  • BigQuery & GCS Lakehouse: Archiving compressed Parquet logs to Hive-partitioned storage queried via external tables.
  • Valkey TTL Caching: Coordinating real-time system state efficiently.

Here is how we broke down the architecture to handle the load:

  • Cloud Pub/Sub for Ingress Decoupling: Placing Cloud Pub/Sub directly behind GKE ingress pods lets us absorb multi-thousand RPS connection spikes with single-digit millisecond response times. A fan-out topology splits incoming streams into parallel tracks for database writes and background archiving, so the ingestion edge never waits on downstream processing.
  • GCS V4 Signed URLs for Direct Uploads: To eliminate API server memory spikes, edge endpoints upload heavy visual media directly to Google Cloud Storage using short-lived signed URLs. This shrinks API request payloads from several megabytes down to just a few kilobytes, taking Base64 decoding entirely out of server memory.
  • Bigtable SSD Dual-Table Strategy: We split high-volume raw telemetry from critical events using a dual-table design. A short-term buffer handles raw ingestion with automated TTL purges, while a dedicated table retains flagged records long-term. Time-ordered row keys enable sub-millisecond range scans while cutting active database storage by over 95%.
  • GCS Parquet Lakehouse + BigQuery: Cloud Dataflow streams cold historical logs into compressed, Hive-partitioned Parquet files on GCS. Querying them directly through BigQuery External Tables cuts storage spend by 50% to 70% while keeping monthly query fees minimal.
  • Memorystore for Valkey (State & Fallbacks): Valkey manages active alert flags via sub-millisecond TTL keys and tracks pending uploads using Sorted Sets. If a client device drops offline mid-upload, a background worker automatically escalates the event after a short timeout so no critical alert is missed.

An ingestion pipeline isn’t robust enough, if downstream reads bottleneck the backend. To prevent that, the target design splits data access into two dedicated paths based on query speed and cost:

  • Real-Time Operational Dashboards: To render event timelines instantly, backend APIs query Bigtable SSD on behalf of operational dashboards. Chronological row keys allow rapid range queries for an event and its context, while images load out-of-band via temporary GCS Signed Read URLs.
  • Ad-Hoc Analytics & MLOps: For historical reporting, model evaluations, and drift detection, team can run serverless SQL using BigQuery External Tables mounted over the GCS Parquet lakehouse for querying cold historical logs on demand with zero dedicated database storage fees.

At a high level, the modernized target architecture establishes a clean, 4-pillar shift across the data plane:

  • Ingress Pattern: Synchronous REST blocking edge devices → Fully decoupled, event-driven Cloud Pub/Sub
  • Media Uploads: Heavy Base64 payloads consuming API gateway RAM → Direct-to-GCS V4 Signed URLs
  • Database Model: Single monolithic database table → Dual-Table Bigtable SSD (Short-Term Raw Cache + High-Priority Events)
  • Historical Data: Cold raw logs on expensive operational SSDs → Compressed Parquet Lakehouse queried via BigQuery External Tables

Here is how all four pillars connect together in our end-to-end GCP target state architecture:

This refactoring of legacy data plane handling ~2 billion monthly event payloads down to an elegant, resilient GCP-native architecture yields several crucial system design lessons:

  1. Decouple the Edge Immediately: Moving from synchronous 2 call REST handshakes to a decoupled Cloud Pub/Sub fan-out architecture transformed our ingestion path. Absorbing 5,000 to 6,000 RPS regional traffic spikes in single-digit milliseconds ensures edge clients never block on backend database availability.
  2. Never Decode Heavy Payloads in API Gateway RAM: Switching from inline Base64 media payloads to GCS V4 Signed URLs shrank request sizes from several megabytes to a few KBs. Bypassing API container memory entirely eliminated pod evictions and memory saturation during morning peak bursts.
  3. Tier Storage to Avoid the SSD FinOps Trap: Retaining cold historical logs on high-performance operational SSDs indefinitely is an expensive anti-pattern. Combining a short-term Bigtable SSD dual-table buffer (with automated TTLs with a GCS Parquet Lakehouse aims to reduce active operational database storage by over 90% and slash long-term cloud storage spend by 50% to 70%.
  4. Isolate Operational OLTP from Analytical OLAP: Running ad-hoc reporting and MLOps drift evaluations via BigQuery External Tables mounted directly over Hive-partitioned GCS Parquet files guarantees zero performance impact on real-time operational dashboard read.

The biggest win of this design wasn’t just cutting storage bills or surviving 6,000 RPS morning bursts, it was getting system stability back. When the edge pipeline asynchronously absorbs traffic surges without spiking container memory or triggering pod evictions, enterprises can stop firefighting infrastructure and go back to shipping core features.

Ultimately, scaling high-throughput architecture isn’t about throwing vertically scaled compute at a fundamentally unoptimized pipeline. It’s about building decoupled, asynchronous paths that absorb massive traffic spikes natively, hold operational costs flat, and simply work when under load!

1 Like