Topic 7 of 11
The other half of the exam guide's data products: the analytical warehouse (BigQuery), messaging (Pub/Sub and Google Cloud Managed Service for Apache Kafka), and stream processing (Dataflow). The exam guide also asks you to load data, including loading from Cloud Storage, and to maintain multi-region redundancy.
Contents
A fully managed, serverless data platform to manage and analyze data with SQL and Python, with no infrastructure. It queries terabytes in seconds and petabytes in minutes.
bq command-line tool, client libraries, REST and RPC APIs, and ODBC and JDBC drivers.Region
A specific place, such as London (europe-west2).
Multi-region
A large area, such as the United States (US) or Europe (EU). It can provide larger quotas.
A multi-region isn't cross-region redundancy
For either location type, BigQuery stores copies of your data in two zones within a single region. A multi-region doesn't add regional redundancy: data is stored in one region and compute is provided only there. For cross-region redundancy, BigQuery offers managed disaster recovery.
The location is chosen when you create the dataset and determines where data is stored and processed, as well as the price.
| Method | When |
|---|---|
| Batch load | Large volumes from local files or Cloud Storage: Avro, Parquet, ORC, CSV, JSON, Datastore and Firestore exports. For scheduled or incremental loads, Google recommends BigQuery Data Transfer Service |
| Streaming | Near real-time data: a BigQuery subscription in Pub/Sub or the Storage Write API |
| Change Data Capture | Datastream replicates row changes from a database to BigQuery |
| Federation | Query external data without loading it |
# Load a CSV from Cloud Storage with a schema bq load --source_format=CSV mydataset.mytable gs://mybucket/mydata.csv ./myschema.json # Wildcards in the Cloud Storage URI bq load --source_format=CSV --autodetect mydataset.mytable "gs://mybucket/fed-*/temp/*.csv"
Schema auto-detection doesn't detect headers if all columns are strings. Loading a local file also uses bq load.
On-demand (per TiB)
Capacity (per slot-hour)
Storage is billed separately: the first 10 GiB each month are free, and tables or partitions not modified for 90 consecutive days move to cheaper long-term storage. Cost estimation is covered in domain D3.
An asynchronous, scalable messaging service that decouples services producing messages from services processing them, with typical latencies around 100 milliseconds. Publishers send messages to a topic and subscribers receive them through subscriptions.
Event ingestion
App or server events that Dataflow delivers to BigQuery, Bigtable, or Cloud Storage.
Real-time distribution
An enterprise event bus shared by several teams.
Replication between databases
Distributing a database's change events.
Parallel processing
Spreading tasks across many workers, for example resizing images.
| Type | How it works |
|---|---|
| Pull | The subscriber client requests messages from the server |
| Push | Pub/Sub sends each message to the subscriber's HTTP endpoint (for example, Cloud Run) |
| Export | Writes messages straight to BigQuery, Cloud Storage, or Bigtable (the last in preview) |
ackDeadline; otherwise it is redelivered.gcloud pubsub topics create orders gcloud pubsub subscriptions create orders-sub --topic=orders gcloud pubsub topics publish orders --message="hello" gcloud pubsub subscriptions pull orders-sub --auto-ack
Batch and streaming data processing with the same programming model. Pipelines read from one or more sources, transform the data, and write it to a destination.
A Google Cloud service to run secure, scalable open-source Apache Kafka clusters.
Sizing
You specify total vCPUs and memory; the service provisions brokers and rebalances partitions as you scale.
Tiered storage
Limited fast local disk plus cheap, effectively unlimited remote storage. You set each topic's retention.
Networking
Reachable from multiple VPCs, projects, and regions through Private Service Connect, with a single bootstrap URL.
Security
SASL authentication (with IAM identities) or mTLS, mandatory TLS, encryption at rest with Google keys or CMEK, automatic patching.
It doesn't allow unauthenticated or unencrypted connections. Authorization combines IAM (cluster management) and Kafka ACLs.
| Pub/Sub | Managed Service for Apache Kafka | |
|---|---|---|
| Model | Serverless, no cluster to size | A Kafka cluster you size by vCPU and memory |
| Parallelism | Per message | Per partition |
| When | Native Google Cloud integration, events and streaming without managing infrastructure | Applications and tools that already use the Kafka API |
| Situation | Answer | Why |
|---|---|---|
| Analyze petabytes with SQL without managing servers | BigQuery | A serverless data warehouse. |
| Load CSV files from a bucket into BigQuery every night on a schedule | BigQuery Data Transfer Service | Schedules recurring load jobs. |
| Get a topic's events into BigQuery in near real time | BigQuery subscription in Pub/Sub | Exports messages straight to a table. |
| Replicate changes from a MySQL database to BigQuery | Datastream (CDC) | Replicates row-level changes. |
| Decouple a service that produces orders from the one that processes them | Pub/Sub | Asynchronous messaging. |
| Transform and enrich an event stream before storing it in BigQuery | Dataflow | Batch and streaming processing with Apache Beam. |
| Migrate applications that already use Apache Kafka clients | Managed Service for Apache Kafka | Managed, compatible Kafka. |
| Predictable BigQuery query costs for a large team | Capacity pricing (slot reservations) | Pay per slot-hour, with optional commitments. |
❓ Is a dataset in the US multi-region protected if a region fails?
No. Data is stored in two zones of a single region. For cross-region redundancy, use managed disaster recovery.
❓ Does a new subscription receive messages published before it was created?
No. Only later ones, unless you use topic retention and message replay.
❓ Does Pub/Sub guarantee ordering and exactly-once delivery by default?
No. The default is at-least-once with no ordering; both can be enabled.
❓ Do you manage VMs to run Dataflow?
No. Dataflow allocates the workers and deletes them when the job ends.
❓ Which SDK does Dataflow use?
Apache Beam, in Java, Python, or Go.
❓ When does a BigQuery table move to long-term storage?
When it isn't modified for 90 consecutive days.
Did you get this topic?
Test what you just learned
An app publishes millions of click events per hour. They must be cleaned, enriched with user data, and stored in BigQuery in near real time, without managing servers. Which architecture should you choose?
Original questions, each with a full explanation.
Start a mock exam