Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove snapshotting of cores and maxprocs. #3979

Merged
merged 1 commit into from Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions main.go
Expand Up @@ -134,8 +134,6 @@ func main() {
s.Warnf("Failed to set GOMAXPROCS: %v", err)
} else {
defer undo()
// Reset these from the snapshots from init for monitor.go
server.SnapshotMonitorInfo()
}

s.WaitForShutdown()
Expand Down
3 changes: 2 additions & 1 deletion server/events.go
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"math/rand"
"net/http"
"runtime"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -603,7 +604,7 @@ func (s *Server) updateServerUsage(v *ServerStats) {
defer s.mu.Lock()
var vss int64
pse.ProcUsage(&v.CPU, &v.Mem, &vss)
v.Cores = numCores
v.Cores = runtime.NumCPU()
}

// Generate a route stat for our statz update.
Expand Down
17 changes: 2 additions & 15 deletions server/monitor.go
Expand Up @@ -36,19 +36,6 @@ import (
"github.com/nats-io/nats-server/v2/server/pse"
)

// Snapshot this
var numCores int
var maxProcs int

func SnapshotMonitorInfo() {
numCores = runtime.NumCPU()
maxProcs = runtime.GOMAXPROCS(0)
}

func init() {
SnapshotMonitorInfo()
}

// Connz represents detailed information on current client connections.
type Connz struct {
ID string `json:"server_id"`
Expand Down Expand Up @@ -1528,8 +1515,8 @@ func (s *Server) createVarz(pcpu float64, rss int64) *Varz {
},
Start: s.start,
MaxSubs: opts.MaxSubs,
Cores: numCores,
MaxProcs: maxProcs,
Cores: runtime.NumCPU(),
MaxProcs: runtime.GOMAXPROCS(0),
Tags: opts.Tags,
TrustedOperatorsJwt: opts.operatorJWT,
TrustedOperatorsClaim: opts.TrustedOperators,
Expand Down