kubecost / kubectl-cost

CLI for determining the cost of Kubernetes workloads
Apache License 2.0
872 stars 55 forks source link

Improve multi-query perf with long-running forward #137

Closed michaelmdresser closed 1 year ago

michaelmdresser commented 1 year ago

What does this PR change?

Shaves about half a second off of a regular kubectl cost namespace query and provides big time savings for multi-workload predictions. These savings should be linear with # of predictions because this avoids re-forwarding for every workload prediction.

How does this PR impact users? (This is the kind of thing that goes in release notes!)

How was this PR tested?

Locally with kubectl cost predict and kubectl cost namespace, observing improved perf in both cases but particularly in predict due to its multi-query nature.

Also checked to make sure ports aren't being leaked after the run with ss -peanut. Saw ports sticking around for a little while. Learned about TCP TIME_WAIT via https://unix.stackexchange.com/questions/68311/why-does-it-take-up-to-several-minutes-to-clean-a-listening-tcp-port-after-a-pro. The port is indeed released after a brief time.

Have you made an update to documentation?

Yes, the README update in this PR.