Skip to content

Commit

Permalink
Don't set block profile rate (#4402)
Browse files Browse the repository at this point in the history
We rarely benefit from block profiles and in many cases a mutex profile
will tell us what we need to know. Additionally, setting the block
profile rate to `1` has the special meaning of capturing every single
blocking event, which can have a fairly significant negative impact on
publish performance.

Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Aug 16, 2023
2 parents 7670cf5 + 19397a5 commit 3f28de8
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions server/server.go
Expand Up @@ -2093,9 +2093,6 @@ func (s *Server) Start() {
// Pprof http endpoint for the profiler.
if opts.ProfPort != 0 {
s.StartProfiler()
} else {
// Enable blocking profile even if no port defined since profiling is always possible over $SYS requests
runtime.SetBlockProfileRate(1)
}

if opts.ConfigFile != _EMPTY_ {
Expand Down Expand Up @@ -2697,9 +2694,6 @@ func (s *Server) StartProfiler() {
s.profiler = l
s.profilingServer = srv

// Enable blocking profile
runtime.SetBlockProfileRate(1)

go func() {
// if this errors out, it's probably because the server is being shutdown
err := srv.Serve(l)
Expand Down

0 comments on commit 3f28de8

Please sign in to comment.