iya-sts
    Preparing search index...

    The heap limit of every process of a node, derived from the container, and the per-process memory report. A static utility class.

    Index
    • Every process's heap budget, computed once per process: carried across the front process's re-exec, taken from an operator's own flag, or derived.

      Returns Budget

      the budget

    • Reads the container's memory limit from its cgroup: v2 first, then v1 and v1's hierarchical limit.

      Parameters

      • Optionalread: Reader

        optional; reads a file, for tests

      Returns ContainerLimit

      { bytes, source }, bytes null when there is no limit

    • The container's memory limit: the cgroup's, else the ECS task's.

      Returns ContainerLimit

      { bytes, source }

    • Derives every process's heap budget. A decision over its arguments.

      Parameters

      • input: {
            configuredMb: number;
            limitBytes: number;
            requestCount: number;
            source?: string;
            surfaceCount: number;
        }

        configuredMb (workers.heapLimitMb), limitBytes and its source, and the two pool sizes

      Returns Budget

      the budget; mb 0 when no limit is to be set

    • One snapshot as the line the report logs.

      Parameters

      • s: Snapshot

        the snapshot

      Returns string

      the line

    • Reads the ECS task's memory limit from the task metadata endpoint, when ECS_CONTAINER_METADATA_URI_V4 is set.

      Returns number

      the limit in bytes, or null

    • Registers process.memory-report with the scheduler, once. Called by protocol_stack.ts in every process that builds the stack.

      Parameters

      • scheduler: any

        the scheduler instance

      Returns void

    • The heap limit an operator set with the flag, on the command line or in NODE_OPTIONS.

      Parameters

      • argv: string[]

        the node options to read (process.execArgv)

      • nodeOptions: string

        NODE_OPTIONS

      Returns number

      the limit in MiB, or 0 when none was set

    • How many processes the kernel's OOM killer has killed in this container's cgroup: v2 memory.events, else v1 memory.oom_control.

      Parameters

      • Optionalread: Reader

        optional; reads a file, for tests

      Returns number

      the count, or null when no counter is visible

    • Reads a file as text; the default reader of every method below.

      Parameters

      • file: string

        the path

      Returns string

      its contents

    • Replaces the front process with itself started with the heap flag, when a limit is due and not yet in force. Called by server.js before it loads the service; does not return when it re-executes.

      Returns { reexec: boolean; why: string }

      what was done: { reexec: false, why }

    • One run of process.memory-report: logs this process's line, sends a request worker's figures to the front process, and answers the run's summary.

      Returns Snapshot

      the snapshot

    • How many request worker threads this process runs: workers.requestCount, except that its default of 1 is 0 where the store cannot coordinate.

      Returns number

      the count, 0 or more

    • What this process is: front, protocol worker or surface worker.

      Returns string

      the role

    • Returns { configuredMb: number; requestCount: number; surfaceCount: number }