Skip to content

Test and document use and performance of Go 1.19's GC memory limit #9327

@dokterbob

Description

@dokterbob

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

In addition to the upcoming Resource Manager, as of version 1.19, Golang has a built-in soft memory limit option, which tunes how the garbage collector operates within memory-constrained environments. This option can be set either using the GOMEMLIMIT environment varibale or by using SetMemoryLimit in the runtime/debug package.

The current default configuration of kubo under high load tends to eat all the memory it can gets until it gets until killed by the OOM, causing frequent restarts of nodes and loss of connections and service.

The new resource manager should be able to address some of these issues. However, documenting and testing Go's native soft memory limits could still significantly improve performance and/or memory usage, particularly under memory-constrained environments:

  1. In addition to the resource manager's decisions on runtime usage, the limit-aware GC would collaborate to have more memory available for the kubo runtime.
  2. Until the resource manager is enabled by default, it could already increase stability and performance.

Note that 2. is written as could. Hence, my request is as follows:

  1. Perform manual tests (with and/or without resource manager) with Golang's soft memory limit set and evaluate results.
  2. Document results as recommendations for production-scale IPFS deployments.
  3. If aforementioned recommendation is positive, add automated testing.
  4. Possibly, call SetMemoryLimit when a memory limit is configured in the resource manager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upkind/featureA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions