Skip to content

Commit

Permalink
add automaxprocs (#840)
Browse files Browse the repository at this point in the history
  • Loading branch information
malud authored Jul 12, 2024
1 parent 5e557e6 commit 2b34b90
Show file tree
Hide file tree
Showing 18 changed files with 1,047 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Unreleased changes are available as `coupergateway/couper:edge` container.
* [`url_decode()` function](https://docs.couper.io/configuration/functions) ([#781](https://github.com/coupergateway/couper/pull/781))
* `bearer = true` attribute for [`jwt` block](https://docs.couper.io/configuration/block/jwt#attributes) to indicate retrieving token from `Authorization: Bearer ...`. This is the new default token source indicator. `header = "Authorization"` is now _deprecated_ in favour of this new attribute. ([#724](https://github.com/coupergateway/couper/pull/724))
* IPv6 support via [`-bind-address`](https://docs.couper.io/configuration/command-line#network-options) option. ([#752](https://github.com/coupergateway/couper/pull/752))
* If Couper starts with `-watch` CLI flag, watch referenced files, too ([#747](https://github.com/coupergateway/couper/pull/747))
* also watch files which has been referenced within the configuration file when using [`-watch`] (https://docs.couper.io/configuration/command-line#basic-options) ([#747](https://github.com/coupergateway/couper/pull/747))
* automatic [`MAXPROCS`](https://pkg.go.dev/runtime#GOMAXPROCS) setting for Couper runtime to respect the number of available CPU resources in cloud environments ([#840](https://github.com/coupergateway/couper/pull/840))

* **Changed**
* More specific error log messages for [`oauth2`](https://docs.couper.io/configuration/block/oauth2) and [`beta_token_request`](https://docs.couper.io/configuration/block/token_request) token request errors ([#755](https://github.com/coupergateway/couper/pull/755))
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ require (
github.com/prometheus/procfs v0.11.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/automaxprocs v1.5.3 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8
go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ=
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8=
go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/fatih/color"
"github.com/sirupsen/logrus"
"go.uber.org/automaxprocs/maxprocs"

"github.com/coupergateway/couper/cache"
"github.com/coupergateway/couper/command"
Expand Down Expand Up @@ -160,6 +161,12 @@ func realmain(ctx context.Context, arguments []string) int {
}
logger := newLogger(confFile.Settings.LogFormat, confFile.Settings.LogLevel, confFile.Settings.LogPretty)

// respect assigned CPU limits
_, err = maxprocs.Set(maxprocs.Logger(logger.Infof))
if err != nil {
logrus.Error("maxprocs.Set: ", err)
}

if flags.DebugEndpoint {
debugListenAndServe(flags.DebugPort, logger)
}
Expand Down
19 changes: 19 additions & 0 deletions vendor/go.uber.org/automaxprocs/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions vendor/go.uber.org/automaxprocs/internal/cgroups/cgroup.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions vendor/go.uber.org/automaxprocs/internal/cgroups/cgroups.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2b34b90

Please sign in to comment.