Skip to content

[Enhancement] Optimize memory usage #1737

@Colvin-Y

Description

@Colvin-Y

Is your feature request related to a problem? Please describe.
Descheduler use too many memory when runs in dry-run mode. In dry-run mode, we perform a full copy of the in-memory data, which results in its memory usage being twice that of the scheduler within the cluster. This is very resource-intensive in large-scale scenarios.

	if d.rs.DryRun {
		klog.V(3).Infof("Building a cached client from the cluster for the dry run")
		// Create a new cache so we start from scratch without any leftovers
		fakeClient := fakeclientset.NewSimpleClientset()
		// simulate a pod eviction by deleting a pod
		fakeClient.PrependReactor("create", "pods", d.podEvictionReactionFnc(fakeClient))
		fakeSharedInformerFactory := informers.NewSharedInformerFactory(fakeClient, 0)

		err := d.ir.CopyTo(fakeClient, fakeSharedInformerFactory)
		if err != nil {
			return err
		}

Describe the solution you'd like
Only retain the necessary fields in the cache, removing unnecessary information to optimize memory usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions