diff options
| author | 2023-01-17 21:59:04 +0100 | |
|---|---|---|
| committer | 2023-01-17 20:59:04 +0000 | |
| commit | acc333c40bcf45fb78a0701596a99e93800fe566 (patch) | |
| tree | c2e236ce1bb6e9871c97a01dde9b22b26fa28742 /go.mod | |
| parent | [feature] Tune sqlite pragmas (#1349) (diff) | |
| download | gotosocial-acc333c40bcf45fb78a0701596a99e93800fe566.tar.xz | |
[feature] Inherit resource limits from cgroups (#1336)
When GTS is running in a container runtime which has configured CPU or
memory limits or under an init system that uses cgroups to impose CPU
and memory limits the values the Go runtime sees for GOMAXPROCS and
GOMEMLIMIT are still based on the host resources, not the cgroup.
At least for the throttling middlewares which use GOMAXPROCS to
configure their queue size, this can result in GTS running with values
too big compared to the resources that will actuall be available to it.
This introduces 2 dependencies which can pick up resource contraints
from the current cgroup and tune the Go runtime accordingly. This should
result in the different queues being appropriately sized and in general
more predictable performance. These dependencies are a no-op on
non-Linux systems or if running in a cgroup that doesn't set a limit on
CPU or memory.
The automatic tuning of GOMEMLIMIT can be disabled by either explicitly
setting GOMEMLIMIT yourself or by setting AUTOMEMLIMIT=off. The
automatic tuning of GOMAXPROCS can similarly be counteracted by setting
GOMAXPROCS yourself.
Diffstat (limited to 'go.mod')
| -rw-r--r-- | go.mod | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -13,6 +13,7 @@ require ( codeberg.org/gruf/go-mutexes v1.1.5 codeberg.org/gruf/go-runners v1.4.0 codeberg.org/gruf/go-store/v2 v2.2.1 + github.com/KimMachineGun/automemlimit v0.2.4 github.com/abema/go-mp4 v0.9.0 github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.5.0 @@ -49,6 +50,7 @@ require ( github.com/uptrace/bun/dialect/sqlitedialect v1.1.9 github.com/wagslane/go-password-validator v0.3.0 github.com/yuin/goldmark v1.5.3 + go.uber.org/automaxprocs v1.5.1 golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d golang.org/x/image v0.3.0 @@ -75,7 +77,11 @@ require ( codeberg.org/gruf/go-pools v1.1.0 // indirect codeberg.org/gruf/go-sched v1.2.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect + github.com/cilium/ebpf v0.4.0 // indirect + github.com/containerd/cgroups v1.0.4 // indirect + github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/go-units v0.4.0 // indirect github.com/dsoprea/go-exif/v3 v3.0.0-20210625224831-a6301f85c82b // indirect github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect @@ -91,6 +97,8 @@ require ( github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-xmlfmt/xmlfmt v0.0.0-20211206191508-7fd73a941850 // indirect github.com/goccy/go-json v0.9.11 // indirect + github.com/godbus/dbus/v5 v5.0.4 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect github.com/golang/protobuf v1.5.2 // indirect @@ -118,6 +126,7 @@ require ( github.com/minio/sha256-simd v1.0.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/opencontainers/runtime-spec v1.0.2 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/pkg/errors v0.9.1 // indirect |
