automax

package
v0.0.96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package automax automatically sets GOMEMLIMIT & GOMAXPROCS to match the linux container memory & cpu quotas, if any.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCpu

func SetCpu(c ...config) func()

SetCpu puts GOMAXPROCS to match the linux container cpu quota (if any), returning an undo function.

It is a no-op in environments without a configured cpu quota.

The optional argument c is only used for internal test purposes.

Example
package main

import (
	"github.com/komuw/ong/automax"
)

func main() {
	undo := automax.SetCpu()
	defer undo()

}
Output:

func SetMem

func SetMem(c ...config) func()

SetMem puts GOMEMLIMIT to match the linux container memory quota (if any), returning an undo function.

It is a no-op in environments without a configured memory quota.

The optional argument c is only used for internal test purposes.

Example
package main

import (
	"github.com/komuw/ong/automax"
)

func main() {
	undo := automax.SetMem()
	defer undo()

}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL