| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Rts
Description
Resolve and apply capabilities, allocation area and heap ceiling from runtime observations. Applying allocation or heap flags re-executes the process once because GHC exposes no setter.
Synopsis
- applyRuntimePosture :: (Text -> IO ()) -> (Text -> IO ()) -> RuntimeOverrides -> IO EffectiveRuntimePlan
- data RtsPosture = RtsPosture {}
- data RuntimeOverrides = RuntimeOverrides {
- roCores :: Maybe Int
- roCoresCeiling :: Maybe Int
- roMaxHeapBytes :: Maybe Int
- data Provenance
- data RuntimePlan = RuntimePlan {
- planCapabilities :: (Int, Provenance)
- planAllocAreaBytes :: (Int, Provenance)
- planMaxHeapBytes :: (Maybe Int, Provenance)
- provenanceClause :: Provenance -> Text
- resolveRuntimePlan :: RuntimeOverrides -> CgroupLimits -> RtsPosture -> RuntimePlan
- currentRtsPosture :: IO RtsPosture
- deriveMaxHeapBytes :: Int -> Int -> Int
- deriveAllocAreaBytes :: Int -> Int -> Int
- requiredRtsFlags :: RtsPosture -> RuntimePlan -> [Text]
- data EffectiveAxis a = EffectiveAxis {
- axDesired :: a
- axObserved :: a
- axProvenance :: Provenance
- data EffectiveRuntimePlan = EffectiveRuntimePlan {}
- axEnforced :: Eq a => EffectiveAxis a -> Bool
- reconcileRuntimePlan :: CgroupLimits -> RuntimePlan -> RtsPosture -> EffectiveRuntimePlan
- appliedRuntimePlan :: CgroupLimits -> RuntimePlan -> RtsPosture -> EffectiveRuntimePlan
- effectiveCapabilities :: EffectiveRuntimePlan -> (Int, Provenance)
- effectiveHeapCeiling :: EffectiveRuntimePlan -> (Maybe Int, Provenance)
- renderEffectivePosture :: EffectiveRuntimePlan -> [Text]
- renderPostureWarnings :: EffectiveRuntimePlan -> [Text]
Applying the resolved posture at boot
applyRuntimePosture :: (Text -> IO ()) -> (Text -> IO ()) -> RuntimeOverrides -> IO EffectiveRuntimePlan Source #
Resolve and apply the runtime plan at boot. It never aborts, and returns the plan the RTS runs with.
The pure resolution core
data RtsPosture Source #
The RTS posture the process is actually running with, read at boot by currentRtsPosture.
Constructors
| RtsPosture | |
Fields
| |
Instances
| Show RtsPosture Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> RtsPosture -> ShowS # show :: RtsPosture -> String # showList :: [RtsPosture] -> ShowS # | |
| Eq RtsPosture Source # | |
Defined in Ecluse.Rts | |
data RuntimeOverrides Source #
The runtime keys the resolution reads. An unset field falls to the next rung, and roCoresCeiling caps the last.
Constructors
| RuntimeOverrides | |
Fields
| |
Instances
| Show RuntimeOverrides Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> RuntimeOverrides -> ShowS # show :: RuntimeOverrides -> String # showList :: [RuntimeOverrides] -> ShowS # | |
| Eq RuntimeOverrides Source # | |
Defined in Ecluse.Rts Methods (==) :: RuntimeOverrides -> RuntimeOverrides -> Bool # (/=) :: RuntimeOverrides -> RuntimeOverrides -> Bool # | |
data Provenance Source #
Where a resolved value came from, for the boot log's provenance clause.
Constructors
| FromConfig | Explicit Écluse configuration ( |
| FromCgroup | Derived from the cgroup CPU quota, or from |
| FromCgroupMemory | Bounded by what the cgroup memory limit can feed, for want of a CPU quota. |
| FromCoresCeiling | Capped at |
| FromHeapCeiling | Fitted to a heap ceiling from config, or from |
| FromRts | Left as the RTS resolved it (baked defaults plus any operator |
Instances
| Show Provenance Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> Provenance -> ShowS # show :: Provenance -> String # showList :: [Provenance] -> ShowS # | |
| Eq Provenance Source # | |
Defined in Ecluse.Rts | |
data RuntimePlan Source #
The resolved runtime posture, each axis with its provenance. A FromRts entry leaves the live posture alone.
Constructors
| RuntimePlan | |
Fields
| |
Instances
| Show RuntimePlan Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> RuntimePlan -> ShowS # show :: RuntimePlan -> String # showList :: [RuntimePlan] -> ShowS # | |
| Eq RuntimePlan Source # | |
Defined in Ecluse.Rts | |
provenanceClause :: Provenance -> Text Source #
The provenance as a bare clause, for consumers composing their own log lines.
resolveRuntimePlan :: RuntimeOverrides -> CgroupLimits -> RtsPosture -> RuntimePlan Source #
Resolve capabilities down the four-rung ladder, the heap ceiling from config, else the cgroup limit, else GHCRTS, and an area to fit.
deriveMaxHeapBytes :: Int -> Int -> Int Source #
The heap ceiling for a memory limit, floored at half of it. The nursery counts inside -M (GHC 9.6 and later).
deriveAllocAreaBytes :: Int -> Int -> Int Source #
The per-capability allocation area: an eighth of the memory limit across the capabilities, in whole MiB from 4 to 64.
requiredRtsFlags :: RtsPosture -> RuntimePlan -> [Text] Source #
The GHCRTS flags the plan needs beyond the live posture. A FromRts entry is the live posture, so it adds none.
The effective plan (desired reconciled with observed)
data EffectiveAxis a Source #
One axis after the boot applied the plan. An apply can fail, so sizing never reads the desired side alone.
Constructors
| EffectiveAxis | |
Fields
| |
Instances
| Show a => Show (EffectiveAxis a) Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> EffectiveAxis a -> ShowS # show :: EffectiveAxis a -> String # showList :: [EffectiveAxis a] -> ShowS # | |
| Eq a => Eq (EffectiveAxis a) Source # | |
Defined in Ecluse.Rts Methods (==) :: EffectiveAxis a -> EffectiveAxis a -> Bool # (/=) :: EffectiveAxis a -> EffectiveAxis a -> Bool # | |
data EffectiveRuntimePlan Source #
The runtime plan reconciled with the live RTS: desired/observed axes, plus observed-only datapoints for sizing.
Constructors
| EffectiveRuntimePlan | |
Fields
| |
Instances
| Show EffectiveRuntimePlan Source # | |
Defined in Ecluse.Rts Methods showsPrec :: Int -> EffectiveRuntimePlan -> ShowS # show :: EffectiveRuntimePlan -> String # showList :: [EffectiveRuntimePlan] -> ShowS # | |
| Eq EffectiveRuntimePlan Source # | |
Defined in Ecluse.Rts Methods (==) :: EffectiveRuntimePlan -> EffectiveRuntimePlan -> Bool # (/=) :: EffectiveRuntimePlan -> EffectiveRuntimePlan -> Bool # | |
axEnforced :: Eq a => EffectiveAxis a -> Bool Source #
Whether the live RTS backs an axis (desired and observed agree).
reconcileRuntimePlan :: CgroupLimits -> RuntimePlan -> RtsPosture -> EffectiveRuntimePlan Source #
Pair the desired plan with the posture the RTS reports, axis by axis.
appliedRuntimePlan :: CgroupLimits -> RuntimePlan -> RtsPosture -> EffectiveRuntimePlan Source #
The effective plan a successful apply would produce, for check-config, which applies nothing.
effectiveCapabilities :: EffectiveRuntimePlan -> (Int, Provenance) Source #
The live capability count, which budgets must not exceed. An unenforced count reads as FromRts.
effectiveHeapCeiling :: EffectiveRuntimePlan -> (Maybe Int, Provenance) Source #
The sizing ceiling: the tighter of desired and observed, so an observed -M below the plan binds.
renderEffectivePosture :: EffectiveRuntimePlan -> [Text] Source #
The boot log's posture lines, one decision per line with its provenance.
renderPostureWarnings :: EffectiveRuntimePlan -> [Text] Source #
The boot log's posture warnings: an axis the RTS is not enforcing, and a count no entitlement backs.