Design, migrate, and run scalable, highly available databases on Google Cloud across relational and NoSQL services, and track your readiness for the Professional Cloud Database Engineer exam.
Prepare and test your skills
Prepare and test your skills
Solution sizing based on current workload metrics and future requirements is the process of converting measured database demand into the right Google Cloud resources with room to grow. The work starts with a baseline of peak CPU, memory, I/O, and network use, translates that baseline into Cloud SQL (opens in a new tab), AlloyDB, Spanner, or Spanner Omni units, and then adds headroom for growth and failover. Undersizing causes slow migrations, errors, and outages, while oversizing wastes money.
The sizing baseline is the set of measured facts used to choose vCPUs, memory, disk size, and node counts. The baseline captures workload type such as online transaction processing (OLTP), online analytical processing (OLAP), or hybrid, plus required latency and throughput in transactions per second (TPS) or per minute (TPM). It also captures total data size, the active working set that must fit in memory, and expected growth in data and throughput over time.
Peak use matters more than average use because the target must survive the busiest periods. CPU and memory analysis uses Cloud Monitoring dashboards for health and capacity, and Query Insights to find the most expensive queries that drive CPU and memory. Disk analysis measures input/output operations per second (IOPS), throughput, and growth under normal and peak load, while network analysis measures latency between clients, writers, readers, and storage. To reduce latency and transfer cost, data is stored in the same zone where it is processed.
Automated inventory makes the baseline complete and accurate:
Mapping baselines to Cloud SQL for SQL Server (opens in a new tab) and AlloyDB for PostgreSQL (opens in a new tab) means choosing instance size, memory, and storage that match the baseline plus growth. Cloud SQL scales on a single instance with vCPU, memory, and SSD persistent disk, and scales out for reads with read replicas. Disk performance depends on both disk size and vCPU count, so both must be sized together.
For Cloud SQL, keep at least 20% free disk space for maintenance, aim for under 10,000 tables per instance to limit upgrade time, and enable automatic storage increases for growth. Changing memory size requires a restart, and if the instance is already at maximum memory the database must be sharded. Only highly available instances with at least one dedicated CPU are covered by the service level agreement (SLA). For SQL Server, size I/O before deployment because throughput is throttled at IOPS or throughput limits, where 4 TB or larger disks, higher vCPU, and parallel I/O raise limits. A representative high-performance test uses 40 vCPU, 262144 MB of memory, maximum degree of parallelism of 8, cost threshold for parallelism of 120, 8 pre-sized tempdb files, pre-sized user files with 64-128 MB autogrow, and 4 TB or larger storage.
AlloyDB for PostgreSQL uses disaggregated compute and storage with multi-tier caching across buffer cache, ultra-fast cache, and intelligent storage. Writes are acknowledged when write-ahead log files persist to regional storage, while block materialization is offloaded to storage. Because of this design, TPS and TPM are the meaningful sizing metrics, not IOPS. Target about 60-70% steady-state CPU utilization to leave margin for spikes and avoid scheduling overhead. Deploy as a zonal single node or a highly available two-node instance, with optional read pools and a secondary cluster in another region for distributed reads or disaster recovery (DR).
The ordered workflow to size AlloyDB from an existing baseline is:
| AlloyDB machine type | Workload scenario | New orders per minute | Converted TPS |
|---|---|---|---|
| 16 vCPU | 30% cached, 3200 warehouses | 252,970 | 9,706 |
| 16 vCPU | 100% cached, 576 warehouses | 428,316 | 16,238 |
| 64 vCPU | 30% cached, 12800 warehouses | 589,598 | 22,853 |
| 64 vCPU | 100% cached, 2304 warehouses | 716,138 | 27,757 |
Exam tip: For AlloyDB for PostgreSQL use TPS and TPM for sizing parity, not IOPS, because disaggregated storage and multi-tier caching make IOPS incomparable to other systems.
Mapping baselines to Cloud Spanner means choosing compute capacity in processing units (PUs), where 1000 PUs equals one node, plus the storage allotment tied to that compute. Spanner bills for storage actually used, but Spanner may reject writes if data exceeds the allotment for the current compute size. Peak throughput for a given compute size also depends on instance configuration, schema design, and dataset characteristics.
| Instance size | Storage allotment per database |
|---|---|
| Smaller than 1 node (1000 PUs) | 1024.0 GiB for every 100 PUs |
| 1 node and larger | 10 TiB for each node |
For example, a 300 GB database can start at 100 PUs and stay below the limit until growth passes 1024.0 GiB, then another 100 PUs must be added. Storage uses binary units where 1 GB equals 2^30^ bytes, also called a gibibyte (GiB), and 1 TB equals 1024 GB. Spanner spreads server resources across zones in the regional, dual-region, or multi-region configuration, with each per-zone resource using the replica in its zone. Instances of 1000 PUs and smaller get one server task per zone, while larger instances get one task per 1000 PUs per zone, which improves performance and allows more database splits. Compute can usually be increased in minutes, and can be reduced except when data exceeds 10 TiB per node.
Spanner Omni maps baselines to host virtual machine (VM) or Kubernetes node resources plus durable block storage. Each VM uses a dedicated, persistent, attachable SSD with an ext4 file system, and local disks are not supported. Allocate 500 GB of storage, 500 IOPS, and 30 MB per second per vCPU, with a minimum of 4 vCPU and 16 GB of RAM on Google Kubernetes Engine (GKE) or VM deployments using zonal pd-ssd or Hyperdisk Balanced storage.
Projecting growth and availability overhead means enlarging the baseline so the database stays reliable as demand rises and parts fail. A complete forecast combines historical trends and request rates, seasonal variations and event spikes, and business growth such as expansion to new geographies. Traffic flows from users and applications to the database tier, so the forecast sets the CPU, memory, throughput, and IOPS that later sizing depends on. Teams estimate cost with the Google Cloud Pricing Calculator and use Migration Center and migVisor for size recommendations when migrating from Amazon RDS for SQL Server (opens in a new tab).
High availability (HA) overhead is extra capacity so traffic keeps flowing during a zone failure. The rule is N+1 redundancy, where each layer has at least one component beyond the minimum needed for forecast load. Designs should use three zones per region and overprovision by a third. Cloud SQL in high availability (opens in a new tab) configuration uses synchronous replication between zones in one region with automatic failover without changing the endpoint. Read replicas offload read-heavy work, while cross-zone replicas create a near active-active topology with recovery point objective (RPO) near zero.
| Approach | Scope | Replication and recovery |
|---|---|---|
| High availability (HA) | Regional deployment in one region | Synchronous replication between zones with zero or near-zero recovery time and RPO |
| Disaster recovery (DR) | Multi-region deployment across regions | Typically asynchronous replication with defined recovery time objective (RTO) and RPO and manual or semi-automated failover |
Disaster recovery overhead covers survival of regional outages through cross-region replicas, multi-region snapshots, and backups in dual-region or multi-region Cloud Storage buckets. Data flows from the primary region to the secondary region through asynchronous replication, with turbo replication available for faster dual-region bucket replication. Validation sustains the model by load-testing normal and peak conditions, repeating benchmarks because efficiency drifts over time, keeping 20% free storage with utilization alerts, accounting for transaction log retention, and checking quotas and Compute Engine reservations for assured zonal capacity.
Evaluating performance and cost tradeoffs means choosing machine types and storage that remove the real bottleneck without paying for unused capacity. Compute Engine (opens in a new tab) machine families set the vCPUs and RAM for a database node, which controls query speed, cache size, and vertical scalability. Vertical scaling moves to a larger shape on the same VM, while horizontal scaling adds more instances to spread load.
Machine families for database VMs are groups of shapes divided by CPU-to-memory ratio and performance guarantees. General-purpose shapes balance price and performance, compute-optimized shapes give the highest performance per core, and memory-optimized shapes give large memory-to-vCPU ratios. Current guidance centers on N4 for general purpose, C3 and C4 including C4A and C3D variants for compute optimized, and M3 and M4 for memory optimized.
| Machine family | Primary use case | Effect on database throughput |
|---|---|---|
| General-purpose, N4 series | Balanced price and performance | Starting point for mixed-use databases, web apps, and development or test |
| Compute-optimized, C3 or C4 series | Highest performance per core | Reduces execution time for complex queries, large processing, and high-volume OLTP |
| Memory-optimized, M3 or M4 series | Large memory-to-vCPU ratios | Caches more data and execution plans in memory instead of reading from disk |
Choose compute-optimized when CPU is saturated by complex queries or high OLTP volume, and choose memory-optimized when slow disk reads can be replaced by a larger cache. High-transaction OLTP with thousands of small concurrent reads and writes needs efficient per-core processing such as C4, while large OLAP warehouses that scan terabytes need high throughput and large caches such as M4. For performance-sensitive MySQL, C4 and C4A are recommended when available in the region, with C3 and C3D as alternatives, offering low consistent latency, Tier_1 networking for higher bandwidth, and controls for host maintenance and single-core turbo boost.
Sizing memory focuses on the working set, or data processed at once, and the RAM buffer pool that caches it. When the buffer pool is larger than the working set, steady-state reads come from memory without disk access, which raises read queries per second (QPS) and lowers disk load. For most MySQL workloads, choose the smallest highmem shape that fits the working set in RAM, providing about 8 GB of RAM per vCPU. For large working sets with low query rates on N4, custom types with extended memory raise the RAM-to-vCPU ratio and lower cost. For writes, block storage matters more than VM memory size. Oracle Database on Compute Engine (opens in a new tab) follows the same split, with N4 or C4 for basic workloads and M4N for complex memory-intensive work.
Controlling cost means using lower-cost shapes where strong guarantees are not needed. N4 uses dynamic resource management for low to medium traffic and development, staging, or test, without the latency consistency of C4, C4A, C3, and C3D. Custom machine types provision cores independently of memory to control licensing and spend, and machine-type recommendations identify overprovisioned VMs. For licensed SQL Server, disabling simultaneous multithreading (SMT) cuts reported cores for licensing by 50%, and overprovisioning CPUs by about 20% before disabling SMT can preserve performance while lowering license cost.
Storage tiering matches disk IOPS, throughput, and latency to workload needs because disk performance directly controls database responsiveness. IOPS is the number of read and write requests per second and is critical for OLTP with many small random operations such as order processing. Throughput is the amount of data moved per second and is essential for OLAP that scans large data for reports, warehousing, or backups.
| Disk type | Performance characteristics | Workload suitability |
|---|---|---|
SSD Persistent Disk (pd-ssd) | Medium to high performance based on disk size and VM vCPUs | Workloads where performance scales with disk and VM size |
| Hyperdisk Balanced | High performance with IOPS and throughput set independently of size | Production data and logs where spend must match needs |
| Hyperdisk Extreme | Very high performance with configurable IOPS and lowest durable latency | High-end mission-critical OLTP such as finance or ecommerce |
| Local SSD | Highest IOPS and throughput from disks attached to the same host | Temporary data without durability needs such as tempdb |
Traffic to Local SSD flows from the VM to storage physically attached to the same host, giving very low latency but no survival across host failure. Performance of SSD Persistent Disk depends on both disk size and vCPUs of the connected Compute Engine VM, while Hyperdisk Balanced and Hyperdisk Extreme depend on provisioned settings that can be raised or lowered with demand. Hyperdisk Balanced offers SSD latency with better than 99.999% durability and encryption with Google-managed or customer-managed keys.
Exam tip: Choose Local SSD only for temporary data such as tempdb and the Windows page file because it has the highest IOPS but no durability; choose Hyperdisk Balanced or Hyperdisk Extreme for data and log files that must survive host failure.
Matching storage layouts to workloads means separating durable data and logs from temporary operations to avoid contention. Using separate disks for data and logs isolates sequential log writes from random data reads in OLTP systems. Offloading tempdb sorts, spills, and rebuilds to Local SSD lets temporary work run at lowest latency without consuming durable IOPS.
| Scenario | Performance requirement | Recommended storage configuration |
|---|---|---|
| High-transaction ecommerce for OLTP | High IOPS for concurrent small reads and writes | Hyperdisk Balanced for data and logs on separate disks with high IOPS, plus Local SSD for tempdb |
| Company data warehouse for OLAP | High throughput to scan terabytes | Hyperdisk Balanced for data with high throughput, plus large memory to cache datasets |
| Development or staging server | Acceptable performance at low cost | Balanced Persistent Disk (pd-balanced) for all database files |
Controlling storage cost means paying only for write I/O actually needed. When the buffer pool exceeds the working set, steady-state reads flow from RAM to the database without disk access, so disk cost follows writes and maintenance such as crash recovery from redo logs or backups that read changes since the last backup. Hyperdisk Balanced IOPS and throughput scale independently, unlike SSD Persistent Disk where higher performance needs a larger disk or VM. For MySQL with InnoDB, size Hyperdisk around the write path to redo logs and later updates to data files and indexes, with headroom for spiky maintenance. This tuning approach from migration of Amazon RDS and Aurora for PostgreSQL (opens in a new tab) helps align provisioned IOPS with real write demand.
Scaling and pricing models describe how capacity grows and how that growth is billed. Vertical scaling makes one instance larger, horizontal scaling adds instances, provisioned capacity pays for reserved size even when idle, autoscaling adjusts with demand, and serverless pays only for use. In Cloud SQL, adding vCPUs or memory increases performance and cost but triggers a restart with downtime, so sizing for growth matters. In Spanner, compute in nodes or PUs sets storage and throughput together, with linear scaling. Regional deployment (opens in a new tab) spreads that capacity for availability, while Oracle E-Business Suite (opens in a new tab) shows the licensed-database tradeoff between self-managed licenses and managed-service rates.
Provisioned capacity fits steady workloads through Compute Engine reservations for assured zonal capacity, Cloud SQL committed use discounts (CUDs) for predictable needs, and Spanner provisioned nodes or PUs. Self-managed databases need separate license planning with bring your own licenses (BYOL), custom types to limit cores, and SMT controls, while managed Cloud SQL includes license cost in the service charge. Stateless managed instance groups (MIGs) scale out automatically with traffic and scale in when quiet, while stateful MIGs cannot autoscale because disks must stay with each VM. Horizontal application growth pressures the database because each new app instance adds its own connection pool, so total connections grow with instance count.
Autoscaling and automatic growth align cost with demand by adding capacity at peaks and removing it when quiet. Automatic storage increases let Cloud SQL grow as data grows, though buffer for peaks is still needed. Cloud Monitoring dashboards show health and capacity, and Active Assist gives idle-instance, overprovisioned-instance, and AlloyDB storage-quota guidance. Further savings come from removing unneeded HA or DR, archiving cold tables to Cloud Storage, and using the AlloyDB columnar engine for analytical queries. Spot VMs give large discounts for fault-tolerant batch work that tolerates preemption, but Compute Engine may reclaim them and MIGs may fail to reach target size when zonal capacity is limited.
| Option | Cost profile | Choose when |
|---|---|---|
| Cloud SQL with SSD | Higher storage price, efficient for active work | Workload needs consistent performance for most uses |
| Cloud SQL with HDD | Lower storage price | Datasets are 10 TB or more, latency-insensitive, or rarely accessed |
| Hyperdisk Balanced | Pay for separately provisioned IOPS and throughput | Volume must be tuned dynamically to varied workloads |
Sizing database compute and storage based on performance requirements is the practice of translating forecast load and workload shape into the right vCPU, memory, and storage configuration. The analysis starts with inventory and forecast, maps demand to Compute Engine or managed-service units, and validates with benchmarking and monitoring. Undersizing causes errors, slow migrations, and application slowdowns, while correct sizing protects throughput and efficiency.
Analyzing workload patterns to choose vCPU and memory starts with how many users, requests, and concurrent operations the system must carry. A complete forecast includes user count and request rate plus historical trends, seasonal variations, event spikes, and business growth such as new geographies. This forecast sets the baseline for vCPUs, memory, disk throughput, and IOPS. Inventory grounds the forecast in source facts such as engine version and edition, CPU and memory size, topology, backup policies, parameters, and customizations for migration from Amazon RDS for SQL Server (opens in a new tab).
Useful assessment sources divide the discovery work:
Benchmarking ties inventory to capacity by measuring resource efficiency, or load versus CPU and memory consumed, under normal and peak conditions, repeated over time because efficiency degrades at very high load. For managed databases, disk performance is based on disk size and vCPU count, so estimate vCPU, IOPS, throughput, and disk together. For Cloud SQL for SQL Server (opens in a new tab) performance-intensive workloads, avoid CPU or memory constraint and use at least 60 GB of memory as a guideline, with Enterprise Plus when higher limits and data cache are needed.
Oracle workloads on Compute Engine divide by demand profile:
| Workload profile | Machine series | When to choose |
|---|---|---|
| Basic and less-demanding | N4 series and C4 series | Volumes, concurrency, and working set fit general-purpose ratios |
| Complex and memory-intensive | M4N series | Large working sets, complex queries, or high concurrency need higher memory-to-CPU ratio |
Concurrency and query complexity decide how well vCPU converts to throughput, since high concurrency can raise CPU faster than throughput and large table counts or oversized files add pressure and affect availability in Cloud SQL (opens in a new tab). Query Insights in Cloud Monitoring finds the most expensive commands to optimize before adding vCPUs. Distance also affects perceived speed, since long paths between writer, reader, and database add latency to inserts, updates, deletes, and reads. Validation uses load tests for normal and peak load, N+1 redundancy so one failure does not saturate remaining CPUs, automatic storage increases with peak buffer, 20% free disk space, and committed use discounts once steady-state size is confirmed.
Determining Spanner scaling units means choosing compute capacity in nodes or processing units to meet throughput, storage, and latency goals without overprovisioning. Compute capacity is provisioned when the AlloyDB for PostgreSQL (opens in a new tab) instance is created for AlloyDB, and when the Spanner instance is created for Spanner, and utilization is monitored to resize as load changes. For Spanner, read and write throughputs scale linearly with compute, so performance needs translate directly into size, and costs stay predictable because payment follows provisioned capacity.
Spanner scaling can be manual by the operator or automatic by the managed autoscaler, which adjusts compute from CPU and storage signals without manual resizing. A minimum capacity is often required even for small workloads, so very small databases still reserve baseline nodes or PUs. Synchronous replication and automatic failover are built in, so maintenance and failover occur with zero downtime without separate replication setup. SQL Server VM instances (opens in a new tab) scale differently on Compute Engine, where machine-type choice and custom shapes control cost and licensing.
Regional configuration changes the latency that scaling must support. Single-region placement keeps quorum close together, while multi-region replicates synchronously across regions for low-latency reads from many locations at the cost of higher write latency because quorum replicas must agree across regions. Leader-aware routing is enabled by default and directs read-write transactions toward the leader replica to reduce that write penalty.
Cost efficiency keeps enough capacity for peaks while keeping average spend near actual use:
Exam tip: More Spanner compute increases storage and throughput together, while multi-region placement favors reads from many locations at the cost of higher write latency; leader-aware routing is on by default to reduce that write penalty.
Evaluating storage performance and caching for Cloud SQL means matching IOPS, throughput, and space to latency needs and growth over time. Traffic flows from the application to the database process and then to storage, so slow storage backs up every upstream request. IOPS measures small operations per second for OLTP responsiveness under many connections, while throughput measures data moved per second for large scans. Persistent disks of type pd-standard cannot deliver the high IOPS and low latency databases need, so standard HDD creates a bottleneck.
Cloud SQL storage type is determined by the machine series selected for the instance. Google Cloud Hyperdisk Balanced is tied to newer series, while SSD and HDD remain options on other series.
| Storage option | Latency and throughput | Choose when |
|---|---|---|
| SSD | Lower latency and higher throughput | Instance runs production or frequently accessed data, the default for N2 series |
| HDD | Higher latency and lower throughput at lower cost | Data is long-term or rarely accessed and does not need high performance |
| Google Cloud Hyperdisk Balanced | Scalable high-performance service | Instance uses C4, C4A, or N4 series, where it is the default and only value |
Enterprise general-purpose shared or dedicated-core instances can use SSD or HDD under the same latency-versus-cost tradeoff. Capacity planning keeps at least 20% free space when automatic increases are disabled or capped, with a disk-utilization alert that fires above 0.8 to warn before the reserve is lost. Growth planning also separates hot and cold data, where hot transactional tables use SSD or Hyperdisk Balanced and audit logs or archives use lower-cost HDD. A cache further reduces storage load because requests flow from the application to the cache first, and hits are served from memory without touching database disks. Memorystore for Redis provides this managed Redis caching layer with low latency and high throughput for repeated reads, with cross-zone replication and automatic failover in HA configuration and graceful degradation serving stale or incomplete data when storage is overloaded.
Continue with this study guide: Size database compute and storage based on performance requirements
Last updated