Skip to content

Commit

Permalink
Merge #48133
Browse files Browse the repository at this point in the history
48133: cli: disable block profiling by default r=petermattis a=petermattis

Disable block profiles by default as they consume a small but measurable
amount of CPU: 1.5% of CPU in one tpcc experiment. Additionally, block
profiling affects Pebble more than RocksDB as RocksDB's synchronization
primitives are invisible to the Go runtime. This levels the playing
field.

Release note (performance improvement): Disable the Go runtime block
profile by default which results in a small but measurable reduction in
CPU usage. The block profile has diminished in utility with the advent
of mutex contention profiles and is almost never used during performance
investigations.

Co-authored-by: Peter Mattis <petermattis@gmail.com>
  • Loading branch information
craig[bot] and petermattis committed Apr 29, 2020
2 parents 2fba79a + 8c5c35c commit 05e45df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cli/start.go
Expand Up @@ -280,8 +280,11 @@ func initBlockProfile() {
// will sample one event per X nanoseconds spent blocking.
//
// The block profile can be viewed with `pprof http://HOST:PORT/debug/pprof/block`
d := envutil.EnvOrDefaultInt64("COCKROACH_BLOCK_PROFILE_RATE",
10000000 /* 1 sample per 10 milliseconds spent blocking */)
//
// The utility of the block profile (aka blocking profile) has diminished
// with the advent of the mutex profile. We currently leave the block profile
// disabled by default as it has a non-zero performance impact.
d := envutil.EnvOrDefaultInt64("COCKROACH_BLOCK_PROFILE_RATE", 0)
runtime.SetBlockProfileRate(int(d))
}

Expand Down

0 comments on commit 05e45df

Please sign in to comment.