mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #32805 from caesarxuchao/more-gc-optimization
Automatic merge from submit-queue Add the uid in a delete event to the absentOwnerCache This is a small optimization to further reduce the traffic sent by the GC. In #31167, GC caches the non-existent owners when it processes the dirtyQueue. As discovered in #32571, there is still small inefficiency, because there are multiple goroutines processing the dirtyQueue, many of them might send a GET to the apiserver before the cache gets populated. This PR populates the cache when GC observes an object gets deleted, which happens before the processing of the dirtyQueue, so it avoids the simultaneous GET sent by the GC workers. cc @lavalamp
This commit is contained in:
commit
0d9685b0b5
@ -410,6 +410,7 @@ func (p *Propagator) processEvent() {
|
||||
// the node's owners list.
|
||||
p.removeDependentFromOwners(existingNode, removed)
|
||||
case event.eventType == deleteEvent:
|
||||
p.gc.absentOwnerCache.Add(accessor.GetUID())
|
||||
if !found {
|
||||
glog.V(6).Infof("%v doesn't exist in the graph, this shouldn't happen", accessor.GetUID())
|
||||
return
|
||||
|
@ -298,8 +298,9 @@ func TestProcessEvent(t *testing.T) {
|
||||
uidToNode: make(map[types.UID]*node),
|
||||
},
|
||||
gc: &GarbageCollector{
|
||||
dirtyQueue: workqueue.NewTimedWorkQueue(),
|
||||
clock: clock.RealClock{},
|
||||
dirtyQueue: workqueue.NewTimedWorkQueue(),
|
||||
clock: clock.RealClock{},
|
||||
absentOwnerCache: NewUIDCache(2),
|
||||
},
|
||||
}
|
||||
for i := 0; i < len(scenario.events); i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user