ecluse
Safe HaskellNone
LanguageGHC2021

Ecluse.Composition.Sizing

Description

The config-derived runtime sizings of the composition root: serve-admission capacity, the two connection-pool sizes and the managers built under them, and the mirror-enqueue buffer tunables. The byte-valued bounds live in Ecluse.Composition.MemoryPlan.

Each resolution is a pure function of the validated configuration plus the process file-descriptor limit. An explicit config value always wins, and resolveSized pairs the result with the boot-log line naming its provenance.

Synopsis

A resolved bound and its boot-log line

resolveSized :: Show a => Text -> Maybe a -> a -> Text -> (a, Text) Source #

A resolved bound and its boot-log line: an explicit config value wins, else the computed default. Every sizing and every memory-plan bound resolves through this.

renderSized :: Show a => Text -> a -> Maybe a -> Text -> Text Source #

The boot-log line for a bound already resolved elsewhere. The explicit config value decides the provenance clause, and the caller supplies the computed alternative.

Connection pools and admission

newPooledManager :: Int -> ManagerSettings -> IO Manager Source #

Open an HTTP manager under an explicit per-host connection bound. Every manager the composition root builds comes from here, so one pool bound applies whatever dials through it.

connectionPoolSettings :: Int -> ManagerSettings -> ManagerSettings Source #

Apply an explicit per-host connection bound to an HTTP manager's settings. Callers apply it after telemetry instrumentation, so it cannot discard the instrumented hooks.

resolveServeAdmission :: Maybe Int -> Int -> (Int, Text) Source #

The serve-admission capacity and its boot-log line: explicit serveMaxInFlight, else max 8 (10 x capabilities) on the post-posture count. The multiplier is where the bench levelled.

resolvePrivateConnections :: Maybe Int -> Int -> (Int, Text) Source #

The private pool size and its boot-log line: privateConnectionsPerHost, else clamp (64, 4096) (nofile / 4). managerConnCount caps retention, not concurrency.

resolvePublicConnections :: Maybe Int -> Int -> (Int, Text) Source #

The public pool size and its boot-log line: publicConnectionsPerHost, else clamp (32, 1024) (nofile / 8). Onboarding fail-over and back-fill streams ride it too.

openFileSoftLimit :: IO Int Source #

The process soft file-descriptor limit (RLIMIT_NOFILE). An infinite or unknown limit falls back to a value that lands the computed pool on its cap rather than overflowing.

Mirror-enqueue buffering

mirrorEnqueueBufferDepth :: Int Source #

The depth of the hand-off buffer in front of the mirror queue. It absorbs a cold npm ci burst, and a job dropped at the cap re-enqueues on the next demand, so overflow defers a mirror.

mirrorEnqueueReportInterval :: Int Source #

How many enqueue-buffer drops or delivery failures pass between warning-log reports. The buffer's callbacks still fire per event, so the counter beside the log stays exact.