This page describes the approximate performance that Cloud Spanner can provide under optimal conditions, factors that can affect performance, and tips for testing and troubleshooting Spanner performance issues.
Performance for typical workloads
Spanner's throughput is linearly scalable with the number of nodes. Each node (1,000 processing units) of compute capacity in a Spanner instance can provide the following approximate throughput (Queries per second) based on the instance configuration:
Instance Configuration Type | Peak Reads (QPS per region) | Peak Writes (QPS total) | |
---|---|---|---|
Regional | 15,000 | or | 2,300 |
Multi-Region (Breakdown by base config) | 10,000 | or | 1,800 |
Read guidance is given per region (because reads can be served from any read-write or read-only region), while write guidance is for the entire configuration. Read guidance assumes you're reading single rows of 1KB. Write guidance assumes that you're writing single rows at 1 KB of data per row.
In general, both the read and write throughputs of a Spanner instance scale linearly as you add more compute capacity (nodes or processing units) to the instance. For example, if a single-region Spanner instance with 2 nodes can provide up to 30,000 reads per second, then a single-region Spanner instance with 4 nodes can provide up to 60,000 reads per second.
If you are not seeing desired performance for your workload from Spanner, see troubleshooting performance regressions for information about common causes.
Performance for regional configurations
At 100% CPU utilization, each 1,000 processing units (1 node) of compute capacity can support up to 15,000 reads per second or 2,300 writes per second (reads and writes are both at 1KB per row). Each optional read-only replica can support an additional 5,000 reads per second.
Performance for multi-region configurations
Each Spanner configuration has slightly different performance characteristics based on the replication topology.
Each 1,000 processing units (1 node) of compute capacity can provide the following peak performance (at 100% CPU):
Base Configuration Name | Approximate Peak Reads (QPS per region) | Approximate Peak Writes (QPS total) |
---|---|---|
asia1 |
10,000 | 1,800 |
eur3 |
10,000 | 1,800 |
eur5 |
10,000 | 1,800 |
eur6 |
10,000 5,000 for each optional read-only replica |
1,800 |
nam3 |
10,000 5,000 for each optional read-only replica |
1,800 |
nam6 |
10,000 in us-central1 and us-east1 5,000 in us-west1 and us-west2 [1] |
1,800 |
nam7 |
10,000 5,000 for each optional read-only replica |
1,800 |
nam8 |
10,000 | 1,800 |
nam9 |
10,000 | 1,800 |
nam10 |
10,000 | 1,800 |
nam11 |
10,000 5,000 for each optional read-only replica |
1,800 |
nam12 |
10,000 | 1,800 |
nam13 |
10,000 | 1,800 |
nam-eur-asia1 |
10,000 | 1,000 |
nam-eur-asia3 |
10,000 | 1,000 |
[1]:
us-west1
andus-west2
provide only half of the QPS performance because they contain one replica per region instead of two.
Read guidance is given per region (because reads can be served from anywhere), while write guidance is for the entire configuration. Read and write guidance assume that you're reading and writing single rows at 1 KB of data per row.
Run your typical workloads against Spanner
Always run your own typical workloads against a Spanner instance
when doing capacity planning, so you can figure out the best resource allocation
for your applications. Google's PerfKit Benchmarker uses
YCSB to benchmark cloud services. You can follow the
PerfKitBenchmarker tutorial for Spanner to create
tests for your own workloads. When doing so, you should tune the parameters in
the benchmarking configuration yaml
files to make sure that the generated benchmark
reflects the following characteristics in your production environment:
- Total size of your database
- Schema (For example: row key size, number of columns, row data sizes)
- Data access pattern (row key distribution)
- Mixture of reads vs. writes
- Type and complexity of queries
Reproducing benchmark numbers
To reproduce the benchmark numbers, follow the tutorial using the
corresponding yaml
files in the throughput_benchmark folder.
Zonal and regional failure protection
When running your workloads in production, it is important to provision enough compute capacity to continue to serve your traffic in the event of the loss of an entire zone (for regional instances) or an entire region (for multi-region instances). See alerts for high CPU utilization for more information on the recommended maximum CPU.
What's next
- Learn how to design a Spanner schema.
- Find out how to monitor Spanner performance.
- Learn how to troubleshoot issues with Key Visualizer.
- Learn about Cloud Spanner pricing.