Documentation
¶
Index ¶
Constants ¶
const DefaultMaxConcurrency = 8
DefaultMaxConcurrency is the limit applied until Configure says otherwise.
Variables ¶
This section is empty.
Functions ¶
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.
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.