Before you begin
Review TPC-C concepts
TPC-C provides the most realistic and objective measure for OLTP performance at various scale factors. Before you get started, consider reviewing .Request a trial license
Reproducing these TPC-C results involves using CockroachDB’s feature to ensure replicas for any given section of data are located on the same nodes that will be queried by the load generator for that section of data. Partitioning helps distribute the workload evenly across the cluster. The partitioning feature requires an Enterprise license, so request a 30-day trial license before you get started. You should receive your trial license via email within a few minutes. You’ll enable your license once your cluster is up-and-running.Step 1. Set up the environment
Provision VMs
- Create 16 VM instances, 15 for CockroachDB nodes and 1 for the TPC-C workload.
- Create all instances in the same region and the same security group.
- Use the
c5d.4xlargemachine type. - Use local SSD instance store volumes. Local SSDs are low latency disks attached to each VM, which maximizes performance. This configuration best resembles what a bare metal deployment would look like, with machines directly connected to one physical disk each. We do not recommend using network-attached block storage.
- Note the internal IP address of each instance. You’ll need these addresses when starting the CockroachDB nodes.
This configuration is intended for performance benchmarking only. For production deployments, there are other important considerations, such as security, load balancing, and data location techniques to minimize network latency. For more details, see the .
Configure your network
CockroachDB requires TCP communication on two ports:26257for inter-node communication (i.e., working as a cluster) and for the TPC-C workload to connect to nodes8080for exposing your DB Console
Inter-node and TPCC-to-node communication
DB Console
Step 2. Start CockroachDB
The
--insecure flag used in this tutorial is intended for non-production testing only. To run CockroachDB in production, use a secure cluster instead.- SSH to the first VM where you want to run a CockroachDB node.
- .
-
Run the command:
Each node will start with a that includes an artificial “rack number” (e.g.,
--locality=rack=0). Use 5 racks for 15 nodes so that 3 nodes will be assigned to each rack. -
Repeat steps 1 - 3 for the other 14 VMs for CockroachDB nodes. Each time, be sure to:
- Adjust the
--advertise-addrflag. - Set the flag to the appropriate “rack number”.
- Adjust the
-
On any of the VMs with the
cockroachbinary, run the one-time command to join the first nodes into a cluster:
Step 3. Configure the cluster
You’ll be importing a large TPC-C data set. To speed that up, you can tweak some cluster settings. You’ll also need to enable the Enterprise license you requested earlier.-
SSH to any VM with the
cockroachbinary. -
Launch the :
-
Adjust some :
-
Enable the trial license you requested earlier:
-
Exit the SQL shell:
Step 4. Import the TPC-C dataset
CockroachDB comes with a number of for simulating client traffic. This step features CockroachDB’s version of the TPC-C workload.- SSH to the VM where you want to run TPC-C.
- .
-
Import the TPC-C dataset:
This will load 1.04 TB of data for 13,000 “warehouses”. This can take around 1 hour to complete. You can monitor progress on the Jobs screen of the DB Console. Open the by pointing a browser to the address in the
adminfield in the standard output of any node on startup.
Step 5. Allow the cluster to rebalance
Next, to divide all of the TPC-C tables and indexes into 5 partitions, one per rack, and then use to pin those partitions to a particular rack.-
Still on the same VM, briefly run TPC-C to let the cluster balance and the leases settle. Bump the file descriptor limits with
ulimitto the high value shown in the following snippet, since the workload generators create a lot of database connections. -
Wait for range rebalancing to finish.
This will likely take 10s of minutes. To watch the progress, go to the Metrics > Queues > Replication Queue graph in the DB Console. Once the Replication Queue gets to
0for all actions and stays there, you can move on to the next step.
Step 6. Run the benchmark
-
Back on the VM with the
workloadbinary, create anaddrsfile containing connection strings to all 15 CockroachDB nodes: -
Run TPC-C for 30 minutes:
Step 7. Interpret the results
Once the workload has finished running, you will see a result similar to the following. The efficiency and latency can be combined to determine whether this was a passing run. You should expect to see an efficiency number above 95%, well above the required minimum of 85%, and p95 latencies well below the required maximum of 10 seconds.See also
- Hardware CockroachDB works well on commodity hardware in public cloud, private cloud, on-prem, and hybrid environments. For hardware recommendations, see our .
- Performance tuning For guidance on tuning a real workload’s performance, see , and for guidance on techniques to minimize network latency in multi-region or global clusters, see .

