From e7866d3600b591279f5225170383414b793fb8e5 Mon Sep 17 00:00:00 2001 From: Cory LaNou Date: Thu, 2 Apr 2015 09:33:09 -0500 Subject: [PATCH 1/3] Set Go Max procs in a better location --- cmd/influxd/main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/influxd/main.go b/cmd/influxd/main.go index 81b57c79b02..890a9d0531e 100644 --- a/cmd/influxd/main.go +++ b/cmd/influxd/main.go @@ -47,10 +47,6 @@ func main() { commit = "unknown" } - // Set parallelism. - runtime.GOMAXPROCS(runtime.NumCPU()) - log.Printf("GOMAXPROCS set to %d", runtime.GOMAXPROCS(0)) - // Shift binary name off argument list. args := os.Args[1:] @@ -78,11 +74,13 @@ func main() { case "": execRun(args) case "backup": + setGoMaxProcs() cmd := NewBackupCommand() if err := cmd.Run(args[1:]...); err != nil { log.Fatalf("backup: %s", err) } case "restore": + setGoMaxProcs() cmd := NewRestoreCommand() if err := cmd.Run(args[1:]...); err != nil { log.Fatalf("restore: %s", err) @@ -98,6 +96,12 @@ func main() { } } +func setGoMaxProcs() { + // Set parallelism. + runtime.GOMAXPROCS(runtime.NumCPU()) + log.Printf("GOMAXPROCS set to %d", runtime.GOMAXPROCS(0)) +} + // execRun runs the "run" command. func execRun(args []string) { // Parse command flags. @@ -121,6 +125,8 @@ func execRun(args []string) { fmt.Print(logo) writePIDFile(*pidPath) + setGoMaxProcs() + // Parse configuration file from disk. config, err := parseConfig(*configPath, *hostname) if err != nil { From 40a97d46f29ae8033dc3b155bf99504ec483767c Mon Sep 17 00:00:00 2001 From: Cory LaNou Date: Thu, 2 Apr 2015 10:05:39 -0500 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5caea937e1..d9b2ccb6cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v0.9.0-rc20 [unreleased] + +### Bugfixes +- [#2147](https://github.com/influxdb/influxdb/pull/2147): Set Go Max procs in a better location +- ## v0.9.0-rc19 [2015-04-01] ### Features From 8fa3571782ba7ddb2832252a524478d71eef786d Mon Sep 17 00:00:00 2001 From: Cory LaNou Date: Thu, 2 Apr 2015 10:27:35 -0500 Subject: [PATCH 3/3] only need max procs for running --- cmd/influxd/main.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/cmd/influxd/main.go b/cmd/influxd/main.go index 890a9d0531e..ce40a519027 100644 --- a/cmd/influxd/main.go +++ b/cmd/influxd/main.go @@ -74,13 +74,11 @@ func main() { case "": execRun(args) case "backup": - setGoMaxProcs() cmd := NewBackupCommand() if err := cmd.Run(args[1:]...); err != nil { log.Fatalf("backup: %s", err) } case "restore": - setGoMaxProcs() cmd := NewRestoreCommand() if err := cmd.Run(args[1:]...); err != nil { log.Fatalf("restore: %s", err) @@ -96,12 +94,6 @@ func main() { } } -func setGoMaxProcs() { - // Set parallelism. - runtime.GOMAXPROCS(runtime.NumCPU()) - log.Printf("GOMAXPROCS set to %d", runtime.GOMAXPROCS(0)) -} - // execRun runs the "run" command. func execRun(args []string) { // Parse command flags. @@ -125,7 +117,9 @@ func execRun(args []string) { fmt.Print(logo) writePIDFile(*pidPath) - setGoMaxProcs() + // Set parallelism. + runtime.GOMAXPROCS(runtime.NumCPU()) + log.Printf("GOMAXPROCS set to %d", runtime.GOMAXPROCS(0)) // Parse configuration file from disk. config, err := parseConfig(*configPath, *hostname)