Skip to content

Commit d1de629

Browse files
committed
Update duration to be kept in watchcache
1 parent 4ccfeb1 commit d1de629

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const (
5252
// initial and resync watch lists to storage.
5353
storageWatchListPageSize = int64(10000)
5454
// defaultBookmarkFrequency defines how frequently watch bookmarks should be send
55-
// in addition to sending a bookmark right before watch deadline
55+
// in addition to sending a bookmark right before watch deadline.
56+
//
57+
// NOTE: Update `eventFreshDuration` when changing this value.
5658
defaultBookmarkFrequency = time.Minute
5759
)
5860

staging/src/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ const (
4747
resourceVersionTooHighRetrySeconds = 1
4848

4949
// eventFreshDuration is time duration of events we want to keep.
50-
eventFreshDuration = 5 * time.Minute
50+
// We set it to `defaultBookmarkFrequency` plus epsilon to maximize
51+
// chances that last bookmark was sent within kept history, at the
52+
// same time, minimizing the needed memory usage.
53+
eventFreshDuration = 75 * time.Second
5154

5255
// defaultLowerBoundCapacity is a default value for event cache capacity's lower bound.
5356
// 100 is minimum in NewHeuristicWatchCacheSizes.
5457
// TODO: Figure out, to what value we can decreased it.
5558
defaultLowerBoundCapacity = 100
5659

5760
// defaultUpperBoundCapacity should be able to keep eventFreshDuration of history.
58-
// With the current 102400 value though, it's not enough for leases in 5k-node cluster,
59-
// but that is conscious decision.
60-
// TODO: Validate if the current value is high enough for large scale clusters.
6161
defaultUpperBoundCapacity = 100 * 1024
6262
)
6363

0 commit comments

Comments
 (0)