Description
Today we construct the request object for every http request for the http probes. This involves concatenating some strings, setting headers, etc.
Probes are simple http get requests that are executed synchronously (for a single probe) and has no request body.
The optimization may be to reuse the request object for all probe executions. This likely save some cpu and memory for the kubelet process.
Some code references:
- DoProbe is executed today on each probe execution.
- New request are being created for each execution.
- New object will need to be stored in worker that for http probes will hold the http request object. This object will need to encapsulate the logic of runProbe method of the prober.
I'm marking this issue as a good first issue, as the issue doesn't require deep knowledge of Kubernetes. However it is not an easy issue, a few parts of code will be affected and change needs to be done very carefully.
Please review code and make sure you understand the task before self-assigning the issue.
Implementation notes
- If you can send the small benchmark results on probes with and without this optimization, it will be a good starting point. Note, for the benchmark, each probe can run once a second, not more often. But the number of probes is virtually unlimited since we are not defining the limit on number of containers per Pod. Realistically we are talking about 110 pods (max) with maybe 2 containers each, with 3 probes each (660 probes).
- Code change may be big. So make sure to help reviewers to review the code. One idea may be to split implementation into multiple commits to simplify the review. First, creating the object encapsulating the logic of
runProbe
, second storing and initializing this object inworker
, and third, actual reusing of the request object.
/sig node
/good-first-issue
/help-wanted
/area kubelet
Activity