netmaker/logic/proc.go
Yabin Ma 5f21c8bb1d
NET-1778: scale test code changes (#3203)
* comment ACL call and add debug message

* add cache for network nodes

* fix load node to network cache issue

* add peerUpdate call 1 min limit

* add debug log for scale test

* release maps

* avoid default policy for node

* 1 min limit for peerUpdate trigger

* mq options

* Revert "mq options"

This reverts commit 10b93d0118.

* set peerUpdate run in sequence

* update for emqx 5.8.2

* remove batch peer update

* change the sleep to 10 millisec to avoid timeout

* add compress and change encrypt for peerUpdate message

* add mem profiling and automaxprocs

* add failover ctx mutex

* ignore request to failover peer

* remove code without called

* remove debug logs

* update emqx to v5.8.2

* change broker keepalive

* add OLD_ACL_SUPPORT setting

* add host version check for message encrypt

* remove debug message

* remove peerUpdate call control

---------

Co-authored-by: abhishek9686 <abhi281342@gmail.com>
2024-12-10 10:15:31 +04:00

37 lines
892 B
Go

package logic
import (
"os"
"runtime"
"runtime/pprof"
"github.com/gravitl/netmaker/logger"
)
func StartCPUProfiling() *os.File {
f, err := os.OpenFile("/root/data/cpu.prof", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
logger.Log(0, "could not create CPU profile: ", err.Error())
}
if err := pprof.StartCPUProfile(f); err != nil {
logger.Log(0, "could not start CPU profile: ", err.Error())
}
return f
}
func StopCPUProfiling(f *os.File) {
pprof.StopCPUProfile()
f.Close()
}
func StartMemProfiling() {
f, err := os.OpenFile("/root/data/mem.prof", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
logger.Log(0, "could not create Memory profile: ", err.Error())
}
defer f.Close()
runtime.GC() // get up-to-date statistics
if err = pprof.WriteHeapProfile(f); err != nil {
logger.Log(0, "could not write memory profile: ", err.Error())
}
}