feat(backend): use automaxprocs for GOMAXPROCS

This commit is contained in:
Łukasz Mierzwa
2021-06-03 13:10:51 +01:00
committed by Łukasz Mierzwa
parent c4bc183897
commit 79c2fbc6e7
5 changed files with 18 additions and 0 deletions
+7
View File
@@ -1,5 +1,12 @@
# Changelog
## [unreleased]
### Added
- Use [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs)
to automatically adjust `GOMAXPROCS` to match Linux container CPU quota.
## v0.86
### Added
+3
View File
@@ -262,6 +262,9 @@ Images are built automatically for:
- release tags in git - `ghcr.io/prymitive/karma:vX.Y.Z`
- main branch commits - `ghcr.io/prymitive/karma:latest`
_NOTE_ karma uses [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs)
to automatically adjust `GOMAXPROCS` to match Linux container CPU quota.
#### Examples
To start a release image run:
+5
View File
@@ -25,6 +25,7 @@ import (
"github.com/prymitive/karma/internal/transform"
"github.com/prymitive/karma/internal/uri"
"github.com/prymitive/karma/ui"
"go.uber.org/automaxprocs/maxprocs"
"github.com/getsentry/sentry-go"
sentryhttp "github.com/getsentry/sentry-go/http"
@@ -454,6 +455,10 @@ func serve(errorHandling pflag.ErrorHandling) error {
return err
}
_, _ = maxprocs.Set(maxprocs.Logger(func(format string, v ...interface{}) {
log.Debug().Msgf(format, v)
}))
if config.Config.History.Enabled {
go historyPoller.run(config.Config.History.Workers)
}
+1
View File
@@ -32,6 +32,7 @@ require (
github.com/rs/zerolog v1.22.0
github.com/spf13/pflag v1.0.5
go.mongodb.org/mongo-driver v1.5.2 // indirect
go.uber.org/automaxprocs v1.4.0
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 // indirect
golang.org/x/sys v0.0.0-20210531080801-fdfd190a6549 // indirect
gopkg.in/go-playground/colors.v1 v1.2.0
+2
View File
@@ -641,6 +641,8 @@ go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/automaxprocs v1.4.0 h1:CpDZl6aOlLhReez+8S3eEotD7Jx0Os++lemPlMULQP0=
go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=