Skip to content

Significant increase in memory usage from v4.18.0 onwards #3713

@stooj

Description

@stooj

Describe what happened

pulumi-kubernetes consumes far more memory after the v4.18.0 release.

Sample program

I'm running a kind cluster for testing:

import * as kubernetes from "@pulumi/kubernetes";

const provider = new kubernetes.Provider("kubernetes-provider", {
  context: "kind-kind",
  enableServerSideApply: true,
});

for (let i = 0; i < 100; i++) {
  new kubernetes.batch.v1.Job(
    `test-job-${i}`,
    {
      spec: {
        template: {
          spec: {
            containers: [
              {
                name: "hello-world",
                image: "busybox",
                command: ["/bin/sh", "-c", `sleep 10`],
              },
            ],
            restartPolicy: "OnFailure",
          },
        },
        backoffLimit: 4,
      },
    },
    { provider },
  );
}

Log output

xychart-beta
    title "Memory usage for `pulumi-kubernetes` versions"
    x-axis "pulumi/kubernetes version"[4.13.1,4.14.0,4.15.0,4.16.0,4.17.1,4.18.0,4.18.1,4.18.2,4.18.3,4.18.4,4.19.0,4.20.0,4.21.0,4.22.0,4.23.0]
    y-axis "Max memory usage (in Mi)" 0 --> 6000
    bar [779,790,761,784,796,5909,5889,6109,6349,4478,4383,4326,4704,4763,5133]
Loading

Affected Resource(s)

No response

Output of pulumi about

CLI
Version      3.177.0
Go Version   go1.24.4
Go Compiler  gc

Plugins
KIND      NAME        VERSION
resource  kubernetes  4.21.0
language  nodejs      3.177.0

Host
OS       nixos
Version  25.05 (Warbler)
Arch     x86_64

This project is written in nodejs: executable='/nix/store/c8jxsih8yy2rnncdmx2hyraizf689nvp-nodejs-22.14.0/bin/node' version='v22.14.0'

Current Stack: stooj/7442/dev

Found no resources associated with dev

Found no pending operations associated with dev

Backend
Name           pulumi.com
URL            https://app.pulumi.com/stooj
User           stooj
Organizations  stooj, team-ce, higara, pequod, demo, higara-free
Token type     personal

Dependencies:
NAME                VERSION
@pulumi/pulumi      3.181.0
@types/node         18.19.118
typescript          5.8.3
@pulumi/kubernetes  4.21.0

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

Labels

impact/performanceSomething is slower than expectedkind/bugSome behavior is incorrect or out of spec

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions