How to Optimize Real-Time ML Prediction Latency on GCP?
You are an ML engineer at a retail company. You have built a model that predicts a coupon to offer an ecommerce customer at checkout based on the items in their cart. When a customer goes to checkout, your serving pipeline, which is hosted on Google Cloud, joins the customer's existing cart with a row in a BigQuery table that contains the customers' historic purchase behavior and uses that as the model's input. The web team is reporting that your model is returning predictions too slowly to load the coupon offer with the rest of the web page. How should you speed up your model's predictions?
Community Votes
57% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
Tests architectural understanding of serving bottlenecks, with the common trap being the assumption that BigQuery materialized views can efficiently handle dynamic, per-request joins for real-time inference.
This scenario evaluates strategies for reducing inference latency when combining transactional cart data with historical customer analytics. The community consensus strongly advocates migrating analytic data stores like BigQuery to low-latency NoSQL databases for online prediction serving.
Option D was frequently selected because materialized views accelerate repeated analytical queries, but they are ineffective here since they cannot precompute joins involving highly dynamic, session-specific cart items at prediction time.
Community Discussion (16 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
BigQuery is fundamentally an OLAP system designed for analytical workloads, not low-latency singleton reads required during real-time inference. To minimize prediction latency, you must offload historical feature retrieval to a purpose-built online database like Cloud Bigtable, Firestore, or Memorystore. These services are optimized for fast key-value lookups and consistently deliver sub-millisecond response times under heavy concurrent traffic.
Why the Other Options Are Wrong
Attaching a GPU accelerates matrix multiplications during model training or inference but does nothing to resolve I/O bottlenecks caused by external data fetches. Deploying additional instances behind a load balancer increases throughput capacity but leaves the underlying data retrieval delay completely unchanged. Creating a materialized view in BigQuery precomputes static joins for reporting dashboards, but it cannot dynamically incorporate unpredictable, session-specific cart items during live checkout requests.Community Comment Notes
Comment [1] directly cites Google’s official architecture documentation, which explicitly warns against using analytical data stores for real-time prediction serving. Comments [6] and [7] correctly identified that materialized views fail here because they cannot account for highly volatile cart data that changes per transaction. Comment [10] reinforced the optimal solution by recommending specialized low-latency stores like Bigtable or Memorystore for feature lookup pipelines.Official Reference
Exam Strategy
When optimizing real-time ML serving, always separate your analytics pipeline from your feature serving layer using purpose-built low-latency databases. Rely on precomputed features or offline joins only when the underlying data remains static between requests, and avoid routing live checkout traffic through analytical databases regardless of cluster scaling.
Related Analysis
Practice All PMLE Questions
Access 65 questions with complete answers and detailed explanations.
View Full PMLE Practice Test →