Skip to content

Bound Concurrency of Pod Scraping (Probably with a Work Pool) #8377

Open

Description

@julz

Describe the feature

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.

Activity

  1. added
    kind/feature
    on Jun 19, 2020
  2. markusthoemmes commented on Jun 19, 2020

    @markusthoemmes
    Contributor

    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.

  3. vagababov commented on Jun 19, 2020

    @vagababov
    Contributor

    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.

  4. vagababov commented on Jun 19, 2020

    @vagababov
    Contributor

    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 🤷

  5. markusthoemmes commented on Jun 19, 2020

    @markusthoemmes
    Contributor

    Not sure we talk about the same thing @vagababov? What does the activator have to do with pod probing in the autoscaler? 🤔

  6. vagababov commented on Jun 19, 2020

    @vagababov
    Contributor

    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 :)

  7. vagababov commented on Jun 19, 2020

    @vagababov
    Contributor

    But we do a lot of probing in activator :)

  8. markusthoemmes commented on Jun 19, 2020

    @markusthoemmes
    Contributor

    Okay, we clarified offline: In my comment about switching to workqueue based stuff I meant metric scraping, not probing. Sorry for the confusion.

  9. skonto commented on Jul 9, 2020

    @skonto
    Contributor

    @julz @vagababov @markusthoemmes I could help here if possible.

  10. markusthoemmes commented on Jul 9, 2020

    @markusthoemmes
    Contributor

    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.

  11. julz commented on Jul 10, 2020

    @julz
    ContributorAuthor

    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?

  12. markusthoemmes commented on Jul 10, 2020

    @markusthoemmes
    Contributor

    I believe so @julz

  13. julz commented on Jul 10, 2020

    @julz
    ContributorAuthor

    cool - @skonto happy to work together on that if you like?

  14. skonto commented on Jul 10, 2020

    @skonto
    Contributor

    @julz sure let's do it :) I will start a doc and we can iterate on it. I will ping you.

  15. 8 remaining items

  16. skonto commented on Jul 21, 2020

    @skonto
    Contributor

    @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.

  17. vagababov commented on Jul 21, 2020

    @vagababov
    Contributor

    100K go routines is probably strongly above what we support per task in any case....

  18. skonto commented on Jul 21, 2020

    @skonto
    Contributor

    @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).

  19. markusthoemmes commented on Jul 22, 2020

    @markusthoemmes
    Contributor

    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.

  20. github-actions commented on Oct 21, 2020

    @github-actions

    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.

  21. added
    lifecycle/stale
    on Oct 21, 2020
  22. nader-ziada commented on May 17, 2022

    @nader-ziada
    Member

    /reopen

    /lifecycle frozen

  23. knative-prow commented on May 17, 2022

    @knative-prow

    @nader-ziada: Reopened this issue.

    Details

    In response to this:

    /reopen

    /lifecycle frozen

    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.

  24. added
    lifecycle/frozen
    and removed
    lifecycle/stale
    on May 17, 2022
  25. dprotaso commented on Aug 2, 2022

    @dprotaso
    Member

    /triage accepted
    /milestone Icebox

  26. added
    triage/accepted
    on Aug 2, 2022
  27. added this to the Icebox milestone on Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/autoscalekind/featurelifecycle/frozentriage/accepted

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions