An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

proxy.golang.org : github.com/tprasadtp/go-autotune

Package autotune automatically configures GOMAXPROCS and GOMEMLIMIT. Importing this package will automatically set GOMAXPROCS and GOMEMLIMIT via runtime.GOMAXPROCS and runtime/debug.SetMemoryLimit respectively, taking into consideration CPU quota and memory limits. Workload with fractional CPU quota (for example, 2.1) may encounter some CPU throttling. For workloads sensitive to CPU throttling, when using Vertical Pod autoscaling it is recommended to set cpu-integer-post-processor-enabled, to ensure CPU recommendation is an integer. If GOMEMLIMIT environment variable is specified, it is ALWAYS used, and limits are ignored. If GOMEMLIMIT environment variable is invalid, runtime MAY panic. Otherwise this package will attempt to detect defined memory limits using platform specific APIs. Memory limit can be soft limit, or hard limit. Hard memory limit cannot be breached by the process and typically leads to OOM killer being invoked for the process group/process when it is exceeded. For this reason, to let garbage collector free up memory early before OOM killer is involved, a small percentage of hard memory limit is set aside as reserved. This memory is fully accessible to the process and the runtime, but acts as a hint to the garbage collector. By default, 10% is set as reserved with maximum reserve value of 100MiB. See DefaultReserveFunc for default reserve value calculator. For Linux, cgroup v2 interface files are used to get memory limits. cgroup memory limit memory.max is hard memory limit and memory.high is soft memory limit. If using soft memory limits, an external process SHOULD monitor pressure stall information of the workload/cgroup AND alleviate the reclaim pressure. For example, when application is running as a systemd unit with, For Windows, QueryInformationJobObject API is used to get memory limits. JOBOBJECT_EXTENDED_LIMIT_INFORMATION defines per process(ProcessMemoryLimit) and per job memory limits(JobMemoryLimit). ProcessMemoryLimit is preferred over JobMemoryLimit. Both are considered hard limits. For a windows container running with, Libraries SHOULD avoid importing autotune package. It should only be imported by the main package. For using a custom init function or configuring manually, use This package MUST NOT be used with other packages which also tweak GOMAXPROCS or GOMEMLIMIT. Some known incompatible packages include, To disable automatic configuration at runtime (for compiled binaries), Set "GOAUTOTUNE" environment variable to "false" or "0". This example checks resource limits and sets GOMAXPROCS and GOMEMLIMIT at specified intervals. This may be useful for cases where resource limits are expected to change. See https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/ for kubernetes in place resource resize documentation. If GOAUTOTUNE environment variable set to "false" or "0", then GOMAXPROCS and GOMEMLIMIT are not modified. This simply prints current GOMAXPROCS and GOMEMLIMIT values. If github.com/tprasadtp/go-autotune package is imported as specified, It should show appropriately configured values for GOMAXPROCS and GOMEMLIMIT.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/tprasadtp/go-autotune
Keywords: automaxprocs , automemlimit , go-automaxprocs , go-automemlimit , go-autotune , go-maxprocs , go-memlimit , golang , gomaxprocs , gomemlimit
License: MIT
Latest release: over 1 year ago
First release: over 1 year ago
Namespace: github.com/tprasadtp
Stars: 3 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 8 days ago

    Loading...
    Readme
    Loading...