Configuration
You can configure automatic CPU profile capture with the following :| Cluster Setting | Description | Default Value |
|---|---|---|
server.cpu_profile.cpu_usage_combined_threshold | The baseline threshold of CPU usage at which a CPU profile is taken from a node. This value is a percentage.
| 65 |
server.cpu\_profile.interval | The period of time after which the high-water mark resets to the baseline value. | 20m0s (20 minutes) |
server.cpu\_profile.duration | The length of time a CPU profile is taken. | 10s (10 seconds) |
server.cpu\_profile.total\_dump\_size\_limit | Maximum combined disk size for preserving CPU profiles. | 128 MiB (128 Mebibytes) |
High-water mark threshold
The Automatic CPU Profiler runs asynchronously in the background. After every second, the Automatic CPU Profiler checks if the CPU usage exceeds the high-water mark threshold. If so, it captures a CPU profile. If a profile capture is already in progress, a second profile is not taken. The Automatic CPU Profiler uses the configuration options to determine the high-water mark threshold. For example, withduration set to 10s, interval set to 20m0s, and cpu_usage_combined_threshold set to 65:
- At
time0the CPU usage polled is70percent. This exceeds the baseline threshold of65, so a10sprofile is captured and the high-water mark threshold becomes70. - After the
10sprofile capture, the Automatic CPU Profiler continues to check every second if the CPU usage now exceeds70percent. - At
time1the CPU usage polled is80percent, another profile is taken for10s, and the high-water mark threshold becomes80. - At
time2, the20m0sinterval aftertime0, the high-water mark threshold is reset to the baseline threshold of65. - The Automatic CPU Profiler continues to poll every second, and captures a profile whenever CPU usage exceeds the high-water mark threshold.
Accessing CPU profiles
- The Automatic CPU Profiler saves the captured CPU profiles to disk on each node’s file system in the . The default path is
cockroach-data/logs/pprof_dump. - The only way to get these CPU profiles is to access the node file system.
- Enabling the Automatic CPU Profiler does not add CPU profiles to .
Overhead
Enabling the automatic CPU profile capture on a cluster will add overhead to the cluster in the form of potential increases in latency and CPU usage.- Monitor the following metrics:
- P50 latency by creating a for the
sql.exec.latency-p50metric

