kimmachinegun / automemlimit Goto Github PK
View Code? Open in Web Editor NEWAutomatically set GOMEMLIMIT to match Linux cgroups(7) memory limit.
License: MIT License
Automatically set GOMEMLIMIT to match Linux cgroups(7) memory limit.
License: MIT License
gosigar can read total memory in many system. (include cgroup)
can we use it for support other system?
Add system memory as an available provider in order to avoid OOMs when running outside of cgroups.
For workloads running outside of cgroups, or for systems without cgroups, it would be useful to have a provider that exposes the total system memory. This way you cold set a percent of system memory automatically as the limit.
If it works normally, does automemlimit work without being affected by the resource with just the code of the example regardless of the size of the resource? I'm currently using it by setting it in the environment variable, but I'm not sure yet because it's been a while since the latest version.
Hey, I just started using this package. I like it! But, I use it alongside automaxprocs, and I noticed automaxprocs always logs when it changes the GOMAXPROCS setting, whereas your package only logs when debug mode is enabled. I think since most people will use both packages, it would be nice if you also logged by default.
In order to support different logging libraries, it would be nice to have logging be an interface to something compatible with the current stdlib log
package.
For example:
import "log"
type Logger interface {
Fatalf(format string, v ...interface{})
Errorf(format string, v ...interface{})
Warnf(format string, v ...interface{})
Infof(format string, v ...interface{})
Debugf(format string, v ...interface{})
}
Can you clarify whether it is required to put this code in an init() method?
I have deployed a k8s pod with both automemlimit
and automaxproc
and I have set the resources to the following:
resources:
limits:
cpu: 2
memory: 4Gi
requests:
cpu: 1
memory: 2Gi
automemlimits
uses the request value rather than the limits values set on the k8s manifest. Is this expected behavior?
automaxprocs
uses the limits value set on manifest rather than the request value.
I was under the impression that automemlimits
did the same thing for memory limits like automaxprocs
did for cpu limits.
Am I missing something here?
Hey, I'd also be interested in this. Well, not necessarily sigar, but rather having automemlimit "just work" even outside a container.
For my use case, I am using Google Cloud run, and currently automemlimit doesn't work because it can't see it is running in a container. Specifically, I get the message
2023/04/23 01:40:07 failed to set GOMEMLIMIT: open /sys/fs/cgroup/cgroup.controllers: no such file or directory.
Originally posted by @mbyio in #4 (comment)
In Kubernetes 1.27, there is now in-place pod resizing.
It would be useful to have a refresh interval that can update the memlimit in case the cgroup settings change.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.