Brains4Cloud
ESEN
Practice

Topic 6 of 11

D2 · Planning and implementing a cloud solution

Databases on Google Cloud

The exam guide lists Cloud SQL, AlloyDB, Spanner, Firestore, Bigtable, and Memorystore among the data products you must be able to choose and deploy, and adds maintaining multi-region redundancy. The key for the exam is matching each requirement (relational or not, scale, latency, availability) to its service. BigQuery, Pub/Sub, Dataflow, and Kafka are in the next article.

Database map

ServiceModelWhen
Cloud SQLRelational (MySQL, PostgreSQL, SQL Server)Traditional apps and migrations without changes
AlloyDBPostgreSQL-compatible relationalDemanding workloads, HTAP, AI with vector search
SpannerDistributed relational (GoogleSQL or PostgreSQL), plus key-value and graphHorizontal scale and very high availability, global
FirestoreNoSQL documentWeb and mobile apps, serverless, also a MongoDB-compatible API
BigtableNoSQL wide-column, key-valueHigh volume, high throughput, low latency: time series, IoT
MemorystoreIn-memory (Redis, Valkey)Caches and sessions with sub-millisecond latency

A fully managed relational database for MySQL, PostgreSQL, and SQL Server. It handles backups, high availability, connectivity, import and export, maintenance, monitoring, and logging.

  • Each instance is a VM with the database engine and a persistent disk, with a static IP address in front.
  • Connectivity over public IP or private IP (only from a VPC), and authorization with the Cloud SQL Auth Proxy or language connectors.
  • It creates databases and users, but it isn't an administration tool: you use clients such as MySQL Workbench, pgAdmin, or SQL Server Management Studio.
  • Pricing depends on storage, CPUs, memory, location, egress traffic, and IP addresses.
Enterprise PlusEnterprise
SLA99.99% (includes maintenance)99.95% (excludes maintenance)
Planned operations downtimeSub-secondA few minutes
PITR log retentionUp to 35 daysUp to 7 days
ExtrasData cache, optimized writes, read pools, advanced cross-region DR, managed connection poolingCore Cloud SQL capabilities

For MySQL 8.4 and 9.7 the default edition is Enterprise Plus.

Cloud SQL: high availability and replicas

High availability (regional instance)

  • A primary and a standby instance in two zones of the same region.
  • Synchronous replication: every write reaches the disks in both zones before it is committed.
  • If the instance or zone fails, the standby becomes the primary (failover). You can fail back later.
  • It costs twice as much as a standalone instance.

Read replicas

  • A read-only copy updated in near real time to offload queries and analytics.
  • No failover: that is what HA is for.
  • Google recommends 10 direct replicas at most; for more, cascading replicas.
  • They can have a different machine size; if the primary's storage grows, theirs does too.
Replica typeWhat for
Cross-regionReads closer to the application, recovery from a regional outage, and migrating between regions (by promoting it)
CascadingReplicas of a replica, to scale reads
ExternalA replica outside Cloud SQL
From an external serverMigrate from an on-premises database to Cloud SQL

Best practice: with HA on the primary, place replicas in another zone. A replica can be promoted to primary in a regional disaster or if the original becomes corrupted.

A fully managed, PostgreSQL-compatible service with a Google-built engine and a disaggregated architecture: compute (nodes) and storage (distributed across zones, grows automatically) scale independently.

Cluster

A logical container for databases and metadata in a region.

Primary instance

Read-write, one per cluster. HA (active and standby nodes in different zones) or basic (one node, for non-production).

Read pool

Read-only instances with automatic load balancing, up to 20 nodes in the cluster.

  • Use cases: HTAP (analytics on live transactional data), low-latency AI with AlloyDB AI (vector search and model invocation), and mission-critical workloads.
  • An in-memory columnar engine to speed up analytical queries, an index advisor, and adaptive autovacuum.
  • On-demand and scheduled backups, and point-in-time recovery.
  • Each instance has a static private IP in your VPC. You manage it with AlloyDB Studio in the console or standard clients such as psql.

A fully managed distributed database with horizontal read and write scaling, automatic sharding, and strong consistency. It supports the GoogleSQL and PostgreSQL dialects, plus key-value, graph (Spanner Graph), full-text search, and vector search. Because it is managed, there is no way to stop or restart an instance.

Regional

Three read-write replicas in three zones; a write quorum of two out of three. 99.99% SLA.

Dual-region

Two regions in the same country. 99.999%. Enterprise Plus only.

Multi-region

More than two regions. 99.999%. Enterprise Plus only.

EditionWhat it adds
StandardRegional configurations, scheduled backups, 7-day PITR, reverse ETL from BigQuery
EnterpriseSpanner Graph, full-text and vector search, managed autoscaling, incremental backups, optional read-only replicas
Enterprise PlusDual-region and multi-region configurations with up to 99.999%, geo-partitioning
  • Compute capacity: in nodes or processing units (1 node = 1,000 PUs). Below one node you must use PUs.
  • You can move an instance from one configuration to another (for example, regional to multi-region) and create custom configurations with read-only replicas in another region.
  • There is a 90-day free trial instance.

A fully managed, serverless NoSQL document database: no capacity provisioning, it scales automatically, and you pay per use. It offers ACID transactions, strongly consistent queries, and single-digit millisecond read latency.

Firestore client libraries

The recommended option for an enterprise document database.

MongoDB compatibility

A wire-compatible API to lift and shift MongoDB apps, with mongosh, mongoimport, or Compass.

With Firebase

Backend as a service for web and mobile apps, with the Firebase SDKs and console.

Availability: 99.99% in regional locations and 99.999% in multi-region locations, with automatic replication across regions.

A sparsely populated table that scales to billions of rows and thousands of columns (terabytes or petabytes), ideal for large volumes of single-keyed data with low latency and high read and write throughput. Compatible with the Apache HBase API.

  • Each table is a sorted key-value map. Only the row key is indexed; related columns are grouped into column families.
  • Typical data: time series, marketing, financial, IoT, graphs. Each value is usually no larger than 10 MB.
  • Performance scales in proportion to nodes; clusters resize without downtime and can autoscale on CPU.
  • To replicate, add a second cluster to the instance and replication starts automatically.
  • Enterprise and Enterprise Plus editions. A 10-day free trial, extendable to 90.

A managed in-memory service for caches with sub-millisecond access: sessions, frequent queries, game leaderboards, real-time analytics.

Memorystore for Redis

  • Basic: standalone instance. Standard: high availability with up to five replicas across zones and a 99.9% SLA.
  • Up to 300 GB; reads scale to five replicas with the read endpoint.
  • Redis protocol compatible: no code changes.
  • Private IPs only, IAM, and in-transit encryption.

Memorystore for Valkey

  • Managed Valkey, with Cluster Mode Enabled (several shards) or Disabled (one shard).
  • Each shard has one primary node and 0 to 5 replicas spread across zones.
  • Supports a subset of Valkey commands.

Multi-region redundancy

The exam guide asks for "maintaining multi-region redundancy across data solutions". Each service handles it differently:

ServiceHow to survive a regional outage
Cloud SQLA cross-region read replica that you promote; in Enterprise Plus, advanced DR with cross-region replication
SpannerDual-region or multi-region configuration (Enterprise Plus)
FirestoreA multi-region location, with automatic replication
BigtableAdd clusters in other regions to the instance
Cloud StorageBuckets in dual-region or multi-region locations (storage article)
BigQueryManaged disaster recovery: a multi-region doesn't provide cross-region redundancy (next article)

Exam scenarios

SituationAnswerWhy
Migrate an on-premises MySQL without changing the applicationCloud SQL for MySQLCompatible managed relational database.
PostgreSQL with heavy analytical queries on live transactional dataAlloyDBHTAP with a columnar engine.
A global relational database with strong consistency and 99.999%Spanner Enterprise Plus multi-regionHorizontal scale with no practical limits.
A mobile app backend with JSON documents and no capacity provisioningFirestoreServerless document database, pay per use.
Petabytes of IoT sensor time series with low latencyBigtableHigh-volume key-value store.
A session cache with sub-millisecond accessMemorystore (Redis or Valkey)Managed in-memory store.
Cloud SQL must stay up if a zone failsHigh availability (regional) configurationStandby instance in another zone with failover.
Offload reporting queries from the primary Cloud SQL instanceRead replicaA near-real-time read-only copy.

Common exam traps

❓ Does a Cloud SQL read replica provide automatic failover?

No. Failover comes from the high availability configuration. A replica can be promoted manually.

❓ How much does a Cloud SQL instance with HA cost?

Twice as much as a standalone instance.

❓ Which Spanner edition do you need for a multi-region configuration?

Enterprise Plus. Standard and Enterprise only support regional configurations.

❓ Does Bigtable index any column?

Not by its model: only the row key is indexed, which is why row key design matters so much.

❓ Do you provision capacity in Firestore?

No. It is serverless and scales automatically, pay per use.

❓ What SLA does Memorystore for Redis Standard have?

99.9%, with replicas across zones. Basic has no high availability.

Did you get this topic?

Test what you just learned

A payments platform needs a strongly consistent relational database that accepts writes from users on several continents, scales horizontally, and offers the highest possible availability. What should it choose?

Ready to test "Databases on Google Cloud"?

Original questions, each with a full explanation.

Start a mock exam