Your team runs a Python Dataflow streaming pipeline that ingests 20 000 JSON events per second from Pub/Sub and writes enriched rows to BigQuery. Each event must be classified by an existing Vertex AI model, and the end-to-end latency budget is 200 ms even during peak load. The solution must stay fully serverless and keep prediction cost as low as possible. How should you integrate the inference step into the pipeline?
Stream events directly into BigQuery and execute a scheduled BigQuery ML remote-model query every 30 seconds to populate the classification column.
Write events to Cloud Storage and launch a Vertex AI batch prediction job every minute, then read the output back into the streaming pipeline.
Invoke the Vertex AI online prediction endpoint synchronously for each individual event inside a MapElements transform.
Use a GroupIntoBatches transform to assemble small bundles of events and send each bundle as a single gRPC request to the Vertex AI online prediction endpoint from the Dataflow worker.
Calling the Vertex AI online prediction endpoint with a micro-batch of records lets the Dataflow worker amortize network overhead across many predictions, meets the sub-200 ms latency target, and keeps costs down because Vertex AI charges per request, not per record. GroupIntoBatches (or a similar Beam transform) assembles small groups of elements, which can then be sent in a single gRPC request to the endpoint while Dataflow auto-scales workers as traffic fluctuates. Making one synchronous call per event would multiply request charges and exceed the latency budget, while batch prediction jobs or scheduled BigQuery ML queries introduce minutes of delay and are therefore unsuitable for a real-time streaming requirement.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of the GroupIntoBatches transform in Dataflow?
Open an interactive chat with Bash
What is gRPC, and why is it used in serverless pipelines like this?
Open an interactive chat with Bash
How does Vertex AI charge for online predictions, and why is batching beneficial?
Open an interactive chat with Bash
What is Dataflow and how does it integrate with Pub/Sub?
Open an interactive chat with Bash
How does GroupIntoBatches transform help reduce latency?
Open an interactive chat with Bash
What are gRPC calls and why are they used in this pipeline?
Open an interactive chat with Bash
GCP Professional Data Engineer
Ingesting and processing the data
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .