limit

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxConcurrency = 8

DefaultMaxConcurrency is the limit applied until Configure says otherwise.

Variables

This section is empty.

Functions

func Configure

func Configure(maxConcurrency int)

Configure applies the concurrency limits, a value below one disables them. It must be called before the collectors are started.

Types

type Semaphore

type Semaphore struct {
	// contains filtered or unexported fields
}

Semaphore bounds the number of operations running at the same time. A limit below one means unbounded.

var (
	Namespaces *Semaphore
	Items      *Semaphore
	Nodes      *Semaphore
	Commands   *Semaphore
)

The collectors fan out per namespace, per pod/node and finally per kubectl/curl invocation. Without an upper bound a large cluster leads to thousands of concurrently running child processes, each with its own resident memory - which is what makes steadybit-debug exhaust the memory of the machine it runs on. The semaphores below bound each of those levels so that the footprint stays independent of the cluster size.

Acquisition order is Namespaces -> Items/Nodes -> Commands. Never acquire a semaphore of an earlier level while holding a later one, otherwise the levels can deadlock each other.

Nodes is separate from Items on purpose: a cluster has far more nodes than steadybit pods, and goroutines queue on a semaphore in FIFO order. Sharing one semaphore would put the thousands of node goroutines ahead of the platform, agent and extension collectors and delay the interesting data until node collection is done.

func New

func New(limit int) *Semaphore

func (*Semaphore) Acquire

func (s *Semaphore) Acquire() func()

Acquire blocks until a slot is free and returns the function that releases it again.

Jump to

Keyboard shortcuts

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