Skip to content

reduce container memory#214

Open
n35k3nd1r wants to merge 2 commits into
Icinga:mainfrom
PlateIT:feat/reduce-container-log-memory
Open

reduce container memory#214
n35k3nd1r wants to merge 2 commits into
Icinga:mainfrom
PlateIT:feat/reduce-container-log-memory

Conversation

@n35k3nd1r

Copy link
Copy Markdown

Summary

Reduce memory retention during synchronization and container log processing.

This change removes two sources of unnecessary retained state during startup and ongoing sync:

  • container log contents are no longer warmed up globally and kept in scheduled job objects
  • sync warmup no longer injects full database objects into the informer store

Motivation

On large Kubernetes/OpenShift clusters, retaining previous database state in memory can grow significantly. Container logs can hold up to the configured maximum log length per container, and the generic sync warmup previously added complete database objects to the informer store before the real Kubernetes cache sync completed.

This can increase sustained heap usage during large-cluster operation and startup synchronization.

Changes

  • Remove the global container log warmup map and mutex.
  • Load the current persisted container log only for the container currently being synchronized.
  • Clear temporary container log contents after each sync job.
  • Normalize log text with strings.ToValidUTF8() before truncating.
  • Replace generic sync warmup object injection with key/UUID tracking.
  • After the Kubernetes informer cache sync completes, enqueue deletes for warmed-up DB objects that are missing or have a different UID.

Expected Impact

The daemon retains less historical synchronization state in memory. Container log memory is reduced from roughly all known/running containers times the maximum stored log length to only currently executing log sync jobs plus normal DB/Kubernetes client overhead.

The sync warmup also avoids keeping full DB objects in the informer store and instead tracks only keys and UUIDs needed to identify stale objects.

@cla-bot cla-bot Bot added the cla/signed CLA is signed by all contributors of a PR label Jun 26, 2026
@n35k3nd1r n35k3nd1r changed the title Feat/reduce container log memory reduce container memory Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla/signed CLA is signed by all contributors of a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant