Documentation
¶
Overview ¶
Package budget decides whether another stack fits into the memory the machine has for siding. Everything here is a pure function; the numbers come from Docker and the compose config.
Index ¶
- Constants
- func Default(dockerMemory int64) int64
- func Estimate(p *compose.Project) int64
- func EstimateLearned(p *compose.Project, repo string, peaks Peaks) int64
- func Learn(home string, samples Peaks) error
- func ParseSize(s string) (int64, error)
- func PeakKey(repo, service string) string
- type Check
- type Peaks
Constants ¶
const ( // ServiceDefault is the estimate of a service without a memory limit. It is a guess, until // siding learns real peaks (v0.3). ServiceDefault int64 = 256 << 20 DefaultShare = 0.75 )
const PeakMargin = 1.25
PeakMargin is added to a learned peak: one-shot stats see the use now, not the maximum.
Variables ¶
This section is empty.
Functions ¶
func Estimate ¶
Estimate is the memory a project will need without learned peaks: per service and replica its memory limit, or ServiceDefault without one.
func EstimateLearned ¶
EstimateLearned is the memory a project of repo will need: per service and replica its learned peak plus PeakMargin, capped at its memory limit; else the limit; else ServiceDefault.
func Learn ¶
Learn records samples, keeping the highest value per key, and writes the cache atomically. A sample another siding process wrote meanwhile may be lost; it is a cache.