aboutsummaryrefslogtreecommitdiff
path: root/weed/command/server.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@uber.com>2021-03-30 01:25:28 -0700
committerChris Lu <chris.lu@uber.com>2021-03-30 02:10:53 -0700
commita1e18a1384fa9bb6223471a7ac843884056392e2 (patch)
tree45a680c4835bcec988c17b69df8af07ce08d86b5 /weed/command/server.go
parent48188abc7b555a579cec0d93af47ba5c0caa6fcc (diff)
downloadseaweedfs-a1e18a1384fa9bb6223471a7ac843884056392e2.tar.xz
seaweedfs-a1e18a1384fa9bb6223471a7ac843884056392e2.zip
server add memory profiling
Diffstat (limited to 'weed/command/server.go')
-rw-r--r--weed/command/server.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/weed/command/server.go b/weed/command/server.go
index aef61a93c..c0ac5ee4c 100644
--- a/weed/command/server.go
+++ b/weed/command/server.go
@@ -2,8 +2,8 @@ package command
import (
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/util/grace"
"os"
- "runtime/pprof"
"strings"
"time"
@@ -15,6 +15,7 @@ import (
type ServerOptions struct {
cpuprofile *string
+ memprofile *string
v VolumeServerOptions
}
@@ -75,6 +76,7 @@ var (
func init() {
serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file")
+ serverOptions.memprofile = cmdServer.Flag.String("memprofile", "", "memory profile output file")
masterOptions.port = cmdServer.Flag.Int("master.port", 9333, "master server http listen port")
masterOptions.metaFolder = cmdServer.Flag.String("master.dir", "", "data directory to store meta data, default to same as -dir specified")
@@ -137,14 +139,7 @@ func runServer(cmd *Command, args []string) bool {
util.LoadConfiguration("security", false)
util.LoadConfiguration("master", false)
- if *serverOptions.cpuprofile != "" {
- f, err := os.Create(*serverOptions.cpuprofile)
- if err != nil {
- glog.Fatal(err)
- }
- pprof.StartCPUProfile(f)
- defer pprof.StopCPUProfile()
- }
+ grace.SetupProfiling(*serverOptions.cpuprofile, *serverOptions.memprofile)
if *isStartingS3 {
*isStartingFiler = true