mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Remove snapshot of cores and maxprocs
Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
2
main.go
2
main.go
@@ -134,8 +134,6 @@ func main() {
|
|||||||
s.Warnf("Failed to set GOMAXPROCS: %v", err)
|
s.Warnf("Failed to set GOMAXPROCS: %v", err)
|
||||||
} else {
|
} else {
|
||||||
defer undo()
|
defer undo()
|
||||||
// Reset these from the snapshots from init for monitor.go
|
|
||||||
server.SnapshotMonitorInfo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.WaitForShutdown()
|
s.WaitForShutdown()
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -603,7 +604,7 @@ func (s *Server) updateServerUsage(v *ServerStats) {
|
|||||||
defer s.mu.Lock()
|
defer s.mu.Lock()
|
||||||
var vss int64
|
var vss int64
|
||||||
pse.ProcUsage(&v.CPU, &v.Mem, &vss)
|
pse.ProcUsage(&v.CPU, &v.Mem, &vss)
|
||||||
v.Cores = numCores
|
v.Cores = runtime.NumCPU()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a route stat for our statz update.
|
// Generate a route stat for our statz update.
|
||||||
|
|||||||
@@ -36,19 +36,6 @@ import (
|
|||||||
"github.com/nats-io/nats-server/v2/server/pse"
|
"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.
|
// Connz represents detailed information on current client connections.
|
||||||
type Connz struct {
|
type Connz struct {
|
||||||
ID string `json:"server_id"`
|
ID string `json:"server_id"`
|
||||||
@@ -1528,8 +1515,8 @@ func (s *Server) createVarz(pcpu float64, rss int64) *Varz {
|
|||||||
},
|
},
|
||||||
Start: s.start,
|
Start: s.start,
|
||||||
MaxSubs: opts.MaxSubs,
|
MaxSubs: opts.MaxSubs,
|
||||||
Cores: numCores,
|
Cores: runtime.NumCPU(),
|
||||||
MaxProcs: maxProcs,
|
MaxProcs: runtime.GOMAXPROCS(0),
|
||||||
Tags: opts.Tags,
|
Tags: opts.Tags,
|
||||||
TrustedOperatorsJwt: opts.operatorJWT,
|
TrustedOperatorsJwt: opts.operatorJWT,
|
||||||
TrustedOperatorsClaim: opts.TrustedOperators,
|
TrustedOperatorsClaim: opts.TrustedOperators,
|
||||||
|
|||||||
Reference in New Issue
Block a user