This page describes how to plan your CockroachDB Standard cluster.
This page describes how resource usage, pricing, and cluster configurations work in CockroachDB Standard. For information on diagnosing and optimizing your resource consumption, see Optimize your Resource Usage.
Request Units
All cluster activity, including SQL queries, bulk operations, and background jobs, is measured in Request Units, or RUs. An RU is an abstracted metric that represents the compute and I/O resources used by a database operation. In addition to queries that you run, background activity, such as automatic statistics to optimize your queries or running a changefeed to an external sink, also consumes RUs. You can review how many request units your cluster has used on the Cluster Overview page.
Provisioned capacity
Provisioned capacity refers to the processing resources (Request Units per sec) reserved for your workload. Each 500 RUs/sec equals approximately 1 vCPU.
Estimate your workload's peak vCPU needs by analyzing available historical data, adjusted for future changes, or by comparing with similar existing workloads. We recommend setting capacity at least 40% above expected peak workload to avoid performance issues.
You can scale the provisioned capacity up or down based on workload changes, allowing for efficient resource management and cost optimization.
For multi-region deployments, the single provisioned capacity value you configure for the cluster applies across all regions, acting as an overall capacity budget from which each region can draw depending on its processing requirements.
Pricing
CockroachDB Standard pricing is determined by two components: provisioned capacity and storage.
Provisioned capacity pricing
CockroachDB Standard processing is priced based on the provisioned capacity for the cluster over time, in increments of 500 RUs/sec.
Since costs are metered in near real-time, a change in the provisioned capacity value will be reflected in the cost for the cluster right away. The monthly bill for the cluster will be prorated to reflect the portion of the month during which the cluster exists.
Storage pricing
You will only be charged for the storage you use. Storage starts at $0.75/GiB hour and the cost varies by region.
Multi-region clusters
When you create a multi-region Standard cluster, you will be prompted to select a Primary region from which CockroachDB will optimize access to data. If you want to change your region configuration, you can use the Cloud Console, or you can back up and restore your data into a new cluster with the desired configuration.
You cannot currently remove regions once they have been added.
For optimal performance, deploy client applications in one of your cluster's configured regions. CockroachDB Standard uses a geolocation routing policy to automatically route clients to the nearest region, even if that region is not one of your cluster's configured regions. This means that if you are running an application from a region that is not used by your cluster, connecting to that region may cause high network latency. This may be acceptable for development, but should be avoided for any production or performance-sensitive applications.
While multi-region CockroachDB Advanced clusters must have a minimum of three regions, Standard clusters can survive zone failures with only two regions. To survive a regional failure, a minimum of three regions is required.
Databases created in CockroachDB Standard will automatically inherit all of a cluster's regions, so it is not necessary to run ALTER DATABASE ... ADD REGION
to configure regions when adding a database to the cluster. To override the default inheritance, you can specify the primary region with the CREATE DATABASE <db_name> WITH PRIMARY REGION
SQL syntax or the sql.defaults_primary_region
setting.
Storage for a multi-region cluster is billed at the same rate as a single-region cluster. However, by default data is replicated three times in the primary region and once in each additional region, and each replica in the additional regions will accrue more storage costs. For example, a three-region cluster with data replicated five times will use 5/3 times the storage space of a single-region cluster where data is replicated three times.
Cross-region operations consume RUs for cross-region networking. Cross-region networking costs depend on the source and destination regions. For read operations, the source region contains the replica and the destination region is the gateway region. For write operations, the source region is the gateway region and the destination region contains the replica. There is a network charge for each replica to which an operation writes. Refer to Pricing for a matrix of cross-region costs.
Keep in mind the following key points when planning your multi-region CockroachDB Standard application's architecture:
- Write-heavy applications may experience a significant increase in RU consumption because replicating writes across all regions consumes more resources.
- Read-heavy applications may experience a smaller increase in RU consumption because the resources required to read from a single region of a multi-region cluster are comparable with a single-region cluster.
- Cross-region reads are an anti-pattern and may significantly increase RU consumption. Features such as global tables, regional by row tables, and follower reads help avoid most cross-region reads.
- Cross-region writes will also consume additional RUs, but should not significantly increase consumption.