Skip to content

No resource limits on any container, and no size bound on retention #71

Closed

Description

@Gerrrt

No service in compose.yaml sets mem_limit, cpus, deploy.resources,
pids_limit or ulimits. On a 2012 MacBook Pro with 7.6 GB shared between six
containers, any one of them can take the host down, and the first symptom would
be the monitoring stack going away.

Current steady-state usage, for sizing:

container memory
grafana 246 MiB
prometheus 137 MiB
alloy 128 MiB
loki 115 MiB
alertmanager 19 MiB
snmp-exporter 16 MiB

Two knock-on effects:

  • ContainerHighMemory can never fire without a limit to measure against —
    tracked separately.
  • Prometheus retention is time-only (--storage.tsdb.retention.time=30d) with
    no --storage.tsdb.retention.size, so disk growth is likewise unbounded and
    handled reactively by HostDiskWillFillIn24h rather than prevented. 23 G of
    98 G used today.

Also absent, and worth deciding on separately: read_only, cap_drop,
security_opt: no-new-privileges. Alloy is the one that cannot have most of
them — it is privileged: true with the Docker socket and /:/rootfs — which
is its own argument for limiting the others.

Found while verifying #12.

Activity

  1. Gerrrt commented on Aug 31, 2026

    @Gerrrt
    OwnerAuthor

    #184 takes the half of this that could be sized, and splits the rest. After it,
    nothing in this issue is untracked.

    Done in #184:

    • pids_limit (512, 1024 for Alloy) on every service, plus init: true — which
      had to come first, because verifying this issue found Grafana already leaking
      two unreaped ssl_client children every 30 seconds from its https healthcheck.
      2437 of them at the time of measurement, on course to exhaust the inherited
      pids.max of 9056 about 3.1 days after each start. pids_limit alone would
      have cut it off sooner rather than protecting it. Nothing in the stack could
      see it — container_tasks_state reads zero for every state.
    • --storage.tsdb.retention.size, at 12 GiB. Not 4: the store's current 1021 MiB
      is not a steady state (prometheus_tsdb_time_retentions_total is 0, nothing
      has ever been evicted), and the write rate went 16.1 → 72.9 MiB/day at 08-17
      when Screenshot capture, and three faults it uncovered #62 fixed cAdvisor. Real steady state is 2.28 GiB, 2.73 GiB once Saruman
      gets an agent.
    • PrometheusSizeRetentionActive, so the ceiling cannot engage silently and
      quietly shorten the 30 days this repository promises in four places.

    Split out, with the reasoning recorded in each:

  2. added a commit that references this issue on Aug 31, 2026
  3. Gerrrt commented on Aug 31, 2026

    @Gerrrt
    OwnerAuthor

    Merged as 7529749 (#184), deployed, and confirmed on the host: Grafana flat at 24 tasks against the 2,495 it was carrying, retention_limit_bytes 12884901888, nothing evicted, 39 rules healthy.

    Closing. Nothing in this issue is untracked — the memory half is #114 (with its gate rewritten), and the rest is #185, #186, #187, #188 and #189. The split and the reasoning for each are in the comment above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions