How to lower resource consumption on startup #4806
-
Hi, I can't find this question in the docs, hopefully one can give me any pointers. When a new replica, most often after updating the operator, has been deployed to a cluster, it will first go over each resource it is responsible for. After that, the replica will go on reconciling on changes etc. However, this way of working results in a spike of resource consumption (CPU / MEMORY) just after startup. Later on it will throttle down and be less resource intensive. My question is as follows, is rate-limiting, probably through the controller options, a way to prevent this spike? If so, how? If not, how do others deal with these scenarios? Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think you need to do something like lim := workqueue.NewMaxOfRateLimiter(
workqueue.NewItemExponentialFailureRateLimiter(15*time.Second, 100*time.Second),
workqueue.NewBucketRateLimiter(10, 100),
)
ctrl.NewControllerManagedBy(mgr).
For(&myv1.MyKind{}).
WithOptions(controller.Options{
RateLimiter: lim,
MaxConcurrentReconciles: 1,
}).
Complete(myReconciler) Give a look at: https://github.com/search?q=repo%3Akubernetes-sigs%2Fcontroller-runtime+RateLimiter&type=code I hope that helps out |
Beta Was this translation helpful? Give feedback.
I think you need to do something like
Give a look at: https://github.com/search?q=repo%3Akubernetes-sigs%2Fcontroller-runtime+RateLimiter&type=code
I hope that helps out