| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Server.Admission.Brake
Description
The memory budget's feedback: how one sample of the collector and the heap moves the budget.
After each major collection the brake measures the live data outside the charges, so the budget may grow until charges and that measured remainder reach the live ceiling. The ceiling also leaves room under the heap's overflow point for the largest request seen lately, which may run past the budget. The brake halves the budget when the collector takes too much of the CPU or the heap nears overflow, and grows it back in small steps while the collector stays calm. Ecluse.Rts.Sampler feeds it.
Synopsis
- data BrakeMarks = BrakeMarks {}
- defaultBrakeMarks :: BrakeMarks
- data BrakeState = BrakeState {
- bsBudget :: Int
- bsOutside :: Maybe Int
- bsLargestRequest :: Int
- bsCalmSamples :: Int
- bsCooldown :: Int
- bsLevel :: BrakeLevel
- initialBrakeState :: BrakeBounds -> BrakeState
- data GcSample = GcSample {}
- brakeStep :: BrakeMarks -> BrakeBounds -> BrakeState -> GcSample -> BrakeState
- data CollectorReading = CollectorReading {
- crCpuNs :: Int64
- crGcCpuNs :: Int64
- crMajorCollections :: Word32
- crLiveBytes :: Int
- gcSharePermille :: CollectorReading -> CollectorReading -> Maybe Int
- data SampleWindow
- newSampleWindow :: Int -> SampleWindow
- windowSample :: SampleWindow -> Maybe CollectorReading -> Int -> Int -> Maybe Int -> (GcSample, SampleWindow)
The marks
data BrakeMarks Source #
The brake's thresholds. Shares are thousandths of the process's CPU time over the sampler's window.
Constructors
| BrakeMarks | |
Fields
| |
Instances
| Show BrakeMarks Source # | |
Defined in Ecluse.Core.Server.Admission.Brake Methods showsPrec :: Int -> BrakeMarks -> ShowS # show :: BrakeMarks -> String # showList :: [BrakeMarks] -> ShowS # | |
| Eq BrakeMarks Source # | |
Defined in Ecluse.Core.Server.Admission.Brake | |
defaultBrakeMarks :: BrakeMarks Source #
Above half the CPU the collector is thrashing, the point where Go's memory limit stops helping. A loaded proxy with no memory pressure spends 20 to 34% of its CPU in the collector.
One step
data BrakeState Source #
The brake's memory between samples.
Constructors
| BrakeState | |
Fields
| |
Instances
| Show BrakeState Source # | |
Defined in Ecluse.Core.Server.Admission.Brake Methods showsPrec :: Int -> BrakeState -> ShowS # show :: BrakeState -> String # showList :: [BrakeState] -> ShowS # | |
| Eq BrakeState Source # | |
Defined in Ecluse.Core.Server.Admission.Brake | |
initialBrakeState :: BrakeBounds -> BrakeState Source #
Start at the boot budget, with nothing measured yet.
One sample's readings. A missing reading leaves its rule out of this step.
Constructors
| GcSample | |
Fields
| |
brakeStep :: BrakeMarks -> BrakeBounds -> BrakeState -> GcSample -> BrakeState Source #
Move the budget by one sample: pressure halves it at most once per cooldown, a lower ceiling cuts it at once, and only a calm stretch grows it. It stays between the floor and the ceiling.
Reading the collector
data CollectorReading Source #
The collector's cumulative counters at one sample.
Constructors
| CollectorReading | |
Fields
| |
Instances
| Show CollectorReading Source # | |
Defined in Ecluse.Core.Server.Admission.Brake Methods showsPrec :: Int -> CollectorReading -> ShowS # show :: CollectorReading -> String # showList :: [CollectorReading] -> ShowS # | |
| Eq CollectorReading Source # | |
Defined in Ecluse.Core.Server.Admission.Brake Methods (==) :: CollectorReading -> CollectorReading -> Bool # (/=) :: CollectorReading -> CollectorReading -> Bool # | |
gcSharePermille :: CollectorReading -> CollectorReading -> Maybe Int Source #
The collector's share of the CPU between two readings, or Nothing when no CPU passed.
data SampleWindow Source #
The recent readings the GC share spans, newest first, and the capacity of that span.
newSampleWindow :: Int -> SampleWindow Source #
An empty window that spans the given number of sampling periods.
windowSample :: SampleWindow -> Maybe CollectorReading -> Int -> Int -> Maybe Int -> (GcSample, SampleWindow) Source #
Fold one reading into the window and form the brake's sample. Live data counts only after a major
collection since an earlier reading, and a missing reading (no -T) leaves the collector's rules out.