Skip to content

Commit 9036430

Browse files
committed
server: enable continuous CPU profiler
This patch enables the CPU profile with a threshold of 75% and a max frequency of 20min. The motivation for this change is that recently, I have noticed a few cases during investigations where CPU utilization spikes but we lack profiles after the fact. This hinders our ability to dig deeper into the source of high CPU usage. Having profiles can help inform us of future AC integrations that we may need, or other performance improvements we can do elsewhere. Informs #97699. Release note (ops change): CRDB will now automatically generate CPU profiles if there is an increase in CPU utilization. This can help investigate possible issues after the fact.
1 parent 17f1eac commit 9036430

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pkg/server/profiler/cpuprofiler.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ package profiler
1212

1313
import (
1414
"context"
15-
"math"
1615
"os"
1716
"runtime/pprof"
1817
"time"
@@ -41,7 +40,8 @@ var cpuUsageCombined = settings.RegisterIntSetting(
4140
"the profiler will never take a profile and conversely, if a value"+
4241
"of 0 is set, a profile will be taken every time the cpu profile"+
4342
"interval has passed or the provided usage is increasing",
44-
math.MaxInt64,
43+
65,
44+
settings.PositiveInt,
4545
)
4646

4747
var cpuProfileInterval = settings.RegisterDurationSetting(
@@ -51,14 +51,16 @@ var cpuProfileInterval = settings.RegisterDurationSetting(
5151
// account the high water mark seen. Without this, if CPU ever reaches 100%,
5252
// we'll never take another profile.
5353
"duration after which the high water mark resets and a new cpu profile can be taken",
54-
5*time.Minute, settings.PositiveDuration,
54+
20*time.Minute,
55+
settings.PositiveDuration,
5556
)
5657

5758
var cpuProfileDuration = settings.RegisterDurationSetting(
5859
settings.ApplicationLevel,
5960
"server.cpu_profile.duration",
6061
"the duration for how long a cpu profile is taken",
61-
10*time.Second, settings.PositiveDuration,
62+
10*time.Second,
63+
settings.PositiveDuration,
6264
)
6365

6466
const cpuProfFileNamePrefix = "cpuprof"

0 commit comments

Comments
 (0)