Prepare and test your skills

Prepare and test your skills

BigQuery (opens in a new tab) slot allocation and query performance evaluation is the practice of managing computational capacity and diagnosing why queries are fast or slow. A slot is a unit of computational capacity, and Google manages the servers, memory, and petabit network behind each slot. BigQuery separates storage from compute, so data stays in distributed, compressed, and encrypted storage while slots scale independently through reservations. Organizations choose between on-demand capacity and dedicated reservations, then assign projects, folders, or organizations to those reservations to control performance, concurrency, and cost.
How BigQuery executes queries explains where slots are spent and why performance varies between runs. When a query runs, BigQuery builds an execution tree that breaks the query into stages containing steps that can run in parallel. Stages exchange intermediate data through a fast, distributed shuffle tier that uses RAM and Google's petabit network to move data quickly to worker nodes. When BigQuery has full information, it generates a query plan that can be viewed as a graphical query execution graph with performance insights. Query execution in BigQuery is dynamic and shared rather than fixed to one machine. Additional monitoring workers track overall progress while the query runs, and BigQuery can dynamically adjust the query plan in response to intermediate stage results. When the query completes, BigQuery writes results to persistent storage and returns them, which allows the next identical query to be served from cached results. Because of shared resources, cached results, and dynamic replanning, repeated queries over the same data can show different execution times. BigQuery smooths performance variance across concurrent workloads through parallel execution and fair scheduling. BigQuery runs many queries in parallel and can queue queries to run when resources become available. As queries start and finish, BigQuery redistributes slots fairly between new and running queries, so performance depends on the number of queries running at a given time rather than submission order. This fair-share behavior is central to diagnosing whether slowness comes from query design or from contention for slots.
Slot reservations are buckets of dedicated query-processing capacity that control which workloads receive guaranteed compute. Administrators dynamically create reservations and assign projects, folders, or organizations to them, and multiple projects can share the same reservation under one billing account. Because BigQuery is a platform as a service (PaaS), scaling means changing the number of reserved slots rather than resizing nodes or copying data. Capacity planning therefore focuses on choosing reservation size and assignment structure to match concurrency and latency needs.
| Pricing model | How cost is calculated | Capacity control |
|---|---|---|
| On-demand pricing | Pay for bytes scanned by each query | Fixed query-processing capacity per project |
| Capacity-based pricing | Purchase dedicated slot capacity through reservations | Configurable reservations assigned to projects, folders, or organizations |
BigQuery workload controls route queries to different capacity pools:
Choose interactive queries when fast response matters, batch queries when the workload can wait for idle shared capacity, and capacity-based reservations when concurrency, predictable performance, or cost isolation requires dedicated slots. Load and extract jobs are free operations that run in a public pool rather than consuming reservation slots. Project-level quotas, custom cost quotas, and billing alerts provide additional controls on query volume and spend.
Slot and query monitoring in BigQuery combines the BigQuery admin panel (opens in a new tab), Cloud Monitoring, and detailed job metadata. BigQuery resource charts let administrators observe how an organization, folder, or reservation uses slots and how queries perform over time. Cloud Monitoring exposes slot and query metrics that separate total available capacity from actual consumption by project, reservation, and job type. To view reservation-wide usage, consuming projects must be added explicitly to the metrics scope of the project where the dashboard is viewed. Key Cloud Monitoring signals for slot evaluation include:
Job-level diagnosis uses the query plan together with INFORMATION_SCHEMA views and APIs. The query plan and timeline show stages, steps, and data flow from one stage to the next through the shuffle tier, and a stage that writes much more output than other stages often indicates that filtering should happen earlier. Execution details can be requested through the INFORMATION_SCHEMA.JOBS views or the jobs.get REST API method to analyze slot milliseconds, bytes processed, queuing time, and stage-level bottlenecks. BigQuery audit logs complement these views with user activity and system events for governance, security review, and analysis of query behavior.
Exam tip: Total slots shows capacity available to one project, while slots used across projects in reservations shows consumption across all projects sharing that reservation and requires those projects in the metrics scope.
Log routing, retention, and auditing for data workloads is the practice of collecting logs and telemetry from pipelines into a central, access-controlled location and using them to prove who did what and how healthy the system is. Detailed logs flow from Cloud Dataflow (opens in a new tab) jobs, AI and ML applications, and underlying infrastructure to Cloud Logging, while numeric health signals flow to Cloud Monitoring. Audit logs, security bulletins, and anomaly detection complete the loop by recording administrative actions and surfacing suspicious behavior.
Cloud Logging is the global service that collects detailed logs from AI and ML applications and from the underlying infrastructure that runs data pipelines. Application code, Dataflow workers, and platform components send event and error context to Cloud Logging, where the logs become essential for troubleshooting and performance analysis. Telemetry data and associated metrics are encrypted at rest, and access to this data is controlled by the Google Cloud project's read permissions. Because Cloud Logging is global, project-level permissions are the boundary that decides who can read retained logs. Log-based troubleshooting depends on this central collection. Log messages can identify a stuck user transform in either batch or streaming pipelines, which narrows a slow or stuck job to specific code. Logging is also used to catch anomalies that suggest a pipeline attack against Cloud Storage buckets. When logs from Dataflow, storage, and networking are in one place, an operator can correlate an incident across stages instead of checking each worker individually.
Audit logging for Dataflow records administrative and data-access activity so teams can answer who changed a job, when the change happened, and what was accessed. Customers remain responsible for securing their own applications that run on Dataflow, including secure coding practices and regular vulnerability testing. That responsibility includes customer-managed encryption keys, networks and VPC Service Controls, and permissions best practices for the data sources and sinks the pipeline touches. Customers are also responsible for monitoring their own applications for security incidents and reporting incidents to Google as necessary. Operational auditing relies on continuous signals:
Exam tip: Do not use the --experiments=enable_stackdriver_agent_metrics option because it uses a deprecated container image that is not maintained and might have unpatched vulnerabilities.
Log routing boundaries in Dataflow define where end-user data and telemetry are allowed to travel. If a pipeline uses Dataflow Shuffle or Dataflow Streaming, specify the region and do not specify the zone pipeline option, and Dataflow auto-selects the zone inside that region. End-user data in transit stays within the worker virtual machines (VMs) and in the same zone, while jobs can still read from and write to sources and sinks outside the VM zone. Data sent to the Dataflow Shuffle or Dataflow Streaming services always remains in the region specified in the pipeline code. Trust isolation controls how long logs remain meaningful for auditing. Use the security mechanisms available in the underlying cloud resources of the pipeline, including the data security capabilities of sources and sinks such as BigQuery (opens in a new tab) and Cloud Storage. Do not mix different trust levels in a single project, because project read permissions control access to telemetry and logs. Keeping production, sensitive, and less-trusted workloads in separate projects preserves a clean audit boundary even though Cloud Logging itself operates globally.
Logs and log-derived health signals track both system health and data-access patterns across the pipeline lifecycle. A typical pipeline moves data through an ordered sequence where each stage emits its own logs and metrics:
Health monitoring across these stages uses the four golden signals for applications:
Dataflow job metrics turn those signals into stage-level evidence that complements raw logs. The backlog_bytes metric measures unprocessed input in bytes by stage and finds a fused step with no throughput, while backlog_elements measures unprocessed input elements for a stage. The processing_parallelism_keys metric measures parallel processing keys over the last five minutes to narrow hot-key warnings and throughput bottlenecks from insufficient parallelism. The system_lag and per_stage_system_lag metrics measure the maximum time data has spent processing or awaiting processing to identify inefficient stages and source bottlenecks.
Observability tools for data processes split by the type of evidence they collect and the question they answer. Cloud Monitoring stores and visualizes metrics, and teams can integrate specialized serving metrics from vLLM or NVIDIA Triton Inference Server through Google Cloud Managed Service for Prometheus. Cloud Trace pinpoints latency across distributed services, which is critical for debugging complex agent or multi-component pipelines. Cloud Profiler (opens in a new tab) identifies performance bottlenecks within function blocks in application code, which helps optimize resource usage and execution time.
| Tool | Collects | Use to answer |
|---|---|---|
| Cloud Monitoring | Infrastructure and application metrics, pre-built and custom dashboards, alerts | Is the pipeline saturated, slow, or erroring, and which stage is affected |
| Cloud Logging | Detailed application and infrastructure logs | What happened around an event or error, and who accessed what |
| Cloud Trace | Latency data and request flows across distributed microservices | Where latency accumulates in a multi-component inference or processing pipeline |
| Cloud Profiler | CPU usage, memory allocation, and function-level bottlenecks | Which function block or transform consumes resources and should be optimized |
Together, routed logs for audit context plus metrics, traces, and profiles for health context give a complete, auditable view of Dataflow and related data services. Logs flow from Dataflow workers to Cloud Logging for event context, metrics flow to Cloud Monitoring for dashboards and alerts, traces flow to Cloud Trace for latency analysis, and profiles flow to Cloud Profiler for code optimization.
Proactive observability for data workloads means building real-time dashboards that show health at a glance and defining alerting policies that fire before users are affected. In Google Cloud, Cloud Monitoring collects, stores, and visualizes metrics for dashboards and alerts, while Cloud Logging provides event context and Cloud Trace and Cloud Profiler explain latency and bottlenecks. Dashboards and alerts are anchored to service-level objectives (SLOs) (opens in a new tab) so every chart and threshold maps to availability, throughput, error rate, or latency that matters to the business.
Reliability goals translate business key performance indicators (KPIs) into technical SLO targets that dashboards track and alerts enforce. A KPI such as customer satisfaction with a conversational assistant maps to success rate, response latency, rate of irrelevant responses, and task-completion rate, while training workloads map to model FLOPS utilization (MFU), iterations per second, and tokens per second. Each technical metric gets a quantified SLO target that defines the acceptable range measured by a metric, so an alert can compare live values against that range. Common SLO targets for data and AI services include:
Once SLOs are set, dashboard panels track burn against each target and alerting policies in Cloud Monitoring notify when error rate or latency threatens the objective. For a data export, throughput and error rate are the two major SLO considerations, monitored through response counts and error-filtered log counts.
Performance dashboards in Cloud Monitoring combine system metrics from Google Cloud services with custom metrics from frameworks and accelerators into one operational view. Metrics flow from managed environments such as GKE nodes and Cloud Run instances, and from training and serving platforms, into Cloud Monitoring, where pre-built dashboards cover Google Cloud services and custom dashboards track workload-specific indicators and infrastructure health. Detailed logs flow from applications and infrastructure into Cloud Logging for troubleshooting, request flows across distributed microservices flow into Cloud Trace for latency analysis, and function-level timing flows into Cloud Profiler for code optimization. Track infrastructure saturation across all resources used by the workload:
Specialized signals require additional collection paths. Metrics from serving frameworks such as vLLM or NVIDIA Triton Inference Server flow into Cloud Monitoring through Google Cloud Managed Service for Prometheus, Agent Platform endpoints export performance metrics directly to Cloud Monitoring, and accelerator details such as per-process utilization and temperature are gathered with tools like NVIDIA Data Center GPU Manager (DCGM). Quota and limit metrics, such as Pub/Sub quota usage and BigQuery (opens in a new tab) quota usage including concurrent connection count, belong on the same dashboard so scaling events do not fail on hidden limits. Monitor the four golden signals for applications on every dashboard because together they separate demand, failure, speed, and capacity problems:
Alerting policies in Cloud Monitoring evaluate one or more metric conditions against thresholds and notify when resource exhaustion, processing latency, or pipeline failure is developing. A policy applies to a selected metric time series, filters it to the relevant resource or application, and fires when the value stays above or below the threshold for the configured duration. The Alerting UI displays a graph of the measured metric compared with the threshold, so operators can see whether throughput dropped or error counts spiked before the incident.
Throughput is monitored with appengine.googleapis.com/http/server/response_count, while error rate is monitored with logging.googleapis.com/log_entry_count filtered for App Engine apps such as list-metrics, get-timeseries, and write-metrics with severity of ERROR. For streaming data pipelines, complementary conditions include growing Pub/Sub unacknowledged message counts and subscription backlog, rising Dataflow backlog bytes, and increasing per-stage system lag, which together distinguish a transient retry storm from a sustained capacity shortfall. Multi-condition policies combine saturation signals such as CPU, memory, or accelerator utilization with latency and error-rate signals, so an alert fires when high utilization coincides with degraded responses rather than on brief, harmless spikes.
Dataflow job metrics explain why a dashboard shows backlog growth or rising system lag by locating the inefficient stage. Cloud Dataflow (opens in a new tab) monitoring for Dataflow correlates incidents and identifies bottlenecks across stages, Cloud Profiler shows pipeline performance inside transforms, and log messages identify a stuck user transform in batch or streaming pipelines. The Dataflow monitoring interface exposes per-stage signals that flow from each pipeline stage into Cloud Monitoring for charting and alerting.
| Metric | What it measures | What it reveals |
|---|---|---|
Backlog bytes (backlog_bytes) | Amount of unprocessed input in bytes by stage | A fused step with no throughput and growing backlog |
Backlog elements (backlog_elements) | Number of unprocessed input elements for a stage | Buildup of pending work at a specific stage |
Processing parallelism keys (processing_parallelism_keys) | Number of parallel processing keys for a stage over the last five minutes | Hot-key skew or insufficient parallelism causing throughput bottlenecks |
System lag (system_lag) and per-stage system lag (per_stage_system_lag) | Maximum time data has spent processing or awaiting processing | Inefficient stages and bottlenecks from data sources |
Processing parallelism keys narrow the issue to specific stages and confirm hot-key warnings such as A hot key ... was detected, which indicate that too much work maps to too few keys. When parallelism is insufficient, pipelines slow or stall even though worker CPU looks healthy, so the fix is pipeline logic or scaling rather than simply adding memory. For the complete set beyond the web interface, the full Dataflow metric list defines additional Google Cloud metrics available for custom dashboards and Monitoring Query Language (MQL)-based alerts.
Exam tip: Use backlog_bytes to find where unprocessed data is accumulating by stage, and use system_lag to measure how long that data has waited or processed — backlog shows size, lag shows delay.
On-demand pricing charges for bytes scanned by each query with fixed query-processing capacity per project, while capacity-based pricing purchases dedicated slot capacity through reservations. Capacity-based reservations are configurable buckets of dedicated query-processing capacity assigned to projects, folders, or organizations to control performance, concurrency, and cost.
Use interactive queries when fast response matters because they are executed as soon as possible and are the default setting for low-latency analysis. Use batch queries when the workload can wait because they are queued and started when idle resources are available in the shared resource pool. Use slot reservations when concurrency, predictable performance, or cost isolation requires dedicated capacity buckets that isolate important workloads from shared-pool contention and on-demand limits.
Total slots shows the total slots available to the project without showing use by other projects sharing the same reservation. Slots used across projects in reservations shows total allocation across all projects consuming from a reservation, and viewing that reservation-wide usage requires adding the consuming projects explicitly to the metrics scope of the project where the dashboard is viewed.
Backlog bytes measures the amount of unprocessed input in bytes by stage and reveals a fused step with no throughput and growing backlog. System lag and per-stage system lag measure the maximum time data has spent processing or awaiting processing to identify inefficient stages and bottlenecks from data sources, so backlog shows size of pending work while lag shows delay.
An analytics team is running interactive dashboard queries in BigQuery using an Enterprise Edition reservation configured with baseline slots and autoscaling capacity. During peak reporting hours, numerous concurrent queries execute simultaneously, diluting the slot allocation per query and causing unacceptable latency. Additionally, finance reports discrepancies between query-level slot runtime metrics and compute reservation charges.
Which combination of configuration and observability practices should the data engineering team implement to stabilize query performance and correctly analyze compute costs?
Last updated