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

Set GOMAXPROCS. #2112

Merged
merged 3 commits into from
Mar 29, 2015
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
- [#2101](https://github.com/influxdb/influxdb/pull/2101): SHOW DATABASES should name returned series "databases".
- [#2104](https://github.com/influxdb/influxdb/pull/2104): Include NEQ when calculating field filters.

### Bugfixes
- [#2112](https://github.com/influxdb/influxdb/pull/2112): Set GOMAXPROCS on startup. This may have been causing extra leader elections, which would cause a number of other bugs or instability.

## v0.9.0-rc16 [2015-03-24]

### Features
Expand Down
8 changes: 6 additions & 2 deletions cmd/influxd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@ const (

func main() {
log.SetFlags(0)
log.SetPrefix(`[srvr] `)
log.SetFlags(log.LstdFlags)
rand.Seed(time.Now().UnixNano())

// If commit not set, make that clear.
if commit == "" {
commit = "unknown"
}

// Set parallelism.
runtime.GOMAXPROCS(runtime.NumCPU())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to suggest we explicitly log this, so the user knows it's happening. E.g.

log.Println("GOMAXPROCS set to", runtime.GOMAXPROCS(0))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea. I'm going to do that and merge this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, cool. Just be sure to add the log line after setting it. :-)

log.Printf("GOMAXPROCS set to %d", runtime.GOMAXPROCS(0))

// Shift binary name off argument list.
args := os.Args[1:]

Expand Down Expand Up @@ -113,8 +119,6 @@ func execRun(args []string) {

// Print sweet InfluxDB logo and write the process id to file.
fmt.Print(logo)
log.SetPrefix(`[srvr] `)
log.SetFlags(log.LstdFlags)
writePIDFile(*pidPath)

// Parse configuration file from disk.
Expand Down