You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bound Concurrency of Pod Scraping (Probably with a Work Pool) #8377
We've discussed this a few times in slack but it seems worth having an issue for it and I didn't spot one, so here one is :).
As of right now we spawn pod scrapes in parallel for ~every revision with no real bound on the amount we'll attempt at once across revisions. This means we can potentially have an extremely large number of active outgoing scrapes, causing more contention than needed, exceeding keep-alive connection pool size and buffer pools etc. In our larger environments, we see large numbers of connections waiting on DNS and GC when revisions*pods gets large.
We should probably introduce some sort of work pool for the scrapers.
In the same vain, we should likely switch the probes into a workqueue based solution (like net-XXX probers) to be able to more easily control the lifecycle of the respective probes.
For the color revisions*pods is exactly 16*revisions, when pod count goes towards infinity, as in it's bounded in number of pods, but not in number of revisions.
In the same vain, we should likely switch the probes into a workqueue based solution (like net-XXX probers) to be able to more easily control the lifecycle of the respective probes.
Here, I am a bit on the border, given that we probably have requests queueing up in activator that we want to start forwarding as fast as possible. And until the pod is probed it receives no requests... so 🤷
We only probe during scale to 0. If we consider 500 revisions all going to 0 at the same time, it's unfortunate, but a much more corner case than just 500 revisions that we need to scrape :)
@vagababov reading these benchmarks from the ants lib shows that most likely unbounded goroutines (independently from scraping) are not the best choice beyond a concurrency number eg. 100K tasks in that benchmark. So I think we need a better approach anyway because I suspect that although scaling out would solve the problem, an optimized instance could lead to less replicas when needed.
@julz describes an issue that occurs in large envs. So we need to clarify what is the number of pods being scraped when issues occur. Btw in theory if we follow the guidelines for building large clusters, we could have thousands of pods and the limit is 150K. However, these benchmarks I mentioned depend on the processing being done which is a dummy function. I dont think the threshold is the same with a realistic workload. In the latter case cost per scraping request could be way more in ms, could use more resources because of http connections in exceeded keep-alive pools etc .
I think a benchmark could shed more light on this as also suggested by @markusthoemmes (assuming its realistic enough).
Yeah let's write a Golang benchmark (I don't think an E2E one is necessary) and see if we can find a break even point between just spawning new goroutines and pooling them for our workloads.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen. Mark the issue as
fresh by adding the comment /remove-lifecycle stale.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Activity
markusthoemmes commentedon Jun 19, 2020
In the same vain, we should likely switch the probes into a workqueue based solution (like net-XXX probers) to be able to more easily control the lifecycle of the respective probes.
vagababov commentedon Jun 19, 2020
For the color
revisions*podsis exactly16*revisions, when pod count goes towards infinity, as in it's bounded in number of pods, but not in number of revisions.vagababov commentedon Jun 19, 2020
Here, I am a bit on the border, given that we probably have requests queueing up in activator that we want to start forwarding as fast as possible. And until the pod is probed it receives no requests... so 🤷
markusthoemmes commentedon Jun 19, 2020
Not sure we talk about the same thing @vagababov? What does the activator have to do with pod probing in the autoscaler? 🤔
vagababov commentedon Jun 19, 2020
We only probe during scale to 0. If we consider 500 revisions all going to 0 at the same time, it's unfortunate, but a much more corner case than just 500 revisions that we need to scrape :)
vagababov commentedon Jun 19, 2020
But we do a lot of probing in activator :)
markusthoemmes commentedon Jun 19, 2020
Okay, we clarified offline: In my comment about switching to workqueue based stuff I meant metric scraping, not probing. Sorry for the confusion.
skonto commentedon Jul 9, 2020
@julz @vagababov @markusthoemmes I could help here if possible.
markusthoemmes commentedon Jul 9, 2020
Yep, just know that this might be a somewhat bigger refactor of the current scraper code.
I think we first need to agree that we actually want work-pooling here as it comes with the risk of us setting the concurrency too low.
julz commentedon Jul 10, 2020
so how do we want to proceed on this? Would a feature proposal doc to hash out the details and any foreseeable edge cases be the best next step?
markusthoemmes commentedon Jul 10, 2020
I believe so @julz
julz commentedon Jul 10, 2020
cool - @skonto happy to work together on that if you like?
skonto commentedon Jul 10, 2020
@julz sure let's do it :) I will start a doc and we can iterate on it. I will ping you.
8 remaining items
skonto commentedon Jul 21, 2020
@vagababov reading these benchmarks from the
antslib shows that most likely unbounded goroutines (independently from scraping) are not the best choice beyond a concurrency number eg. 100K tasks in that benchmark. So I think we need a better approach anyway because I suspect that although scaling out would solve the problem, an optimized instance could lead to less replicas when needed.vagababov commentedon Jul 21, 2020
100K go routines is probably strongly above what we support per task in any case....
skonto commentedon Jul 21, 2020
@julz describes an issue that occurs in large envs. So we need to clarify what is the number of pods being scraped when issues occur. Btw in theory if we follow the guidelines for building large clusters, we could have thousands of pods and the limit is 150K. However, these benchmarks I mentioned depend on the processing being done which is a dummy function. I dont think the threshold is the same with a realistic workload. In the latter case cost per scraping request could be way more in ms, could use more resources because of http connections in exceeded keep-alive pools etc .
I think a benchmark could shed more light on this as also suggested by @markusthoemmes (assuming its realistic enough).
markusthoemmes commentedon Jul 22, 2020
Yeah let's write a Golang benchmark (I don't think an E2E one is necessary) and see if we can find a break even point between just spawning new goroutines and pooling them for our workloads.
github-actions commentedon Oct 21, 2020
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with
/reopen. Mark the issue asfresh by adding the comment
/remove-lifecycle stale.nader-ziada commentedon May 17, 2022
/reopen
/lifecycle frozen
knative-prow commentedon May 17, 2022
@nader-ziada: Reopened this issue.
Details
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
dprotaso commentedon Aug 2, 2022
/triage accepted
/milestone Icebox