Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N^2 RDS memory for SNI #7923

Closed
phylake opened this issue Aug 14, 2019 · 11 comments
Closed

N^2 RDS memory for SNI #7923

phylake opened this issue Aug 14, 2019 · 11 comments
Assignees
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!
Milestone

Comments

@phylake
Copy link

phylake commented Aug 14, 2019

Title: N^2 RDS memory for SNI

Description:
Every filter_chain_match in SNI has its own HTTP connection manager which gets its own copy of the full RDS config. For every filter chain match there's going to be a route entry (N^2).

I was looking at how to share the ConfigImpl between HTTP connection managers but what stumped me was the Server::Configuration::FactoryContext& factory_context that's passed down to ultimately be used by PerFilterConfig

  1. What's the best way to address this short term? (i.e. a hack to reduce our memory footprint of 30GiB)
  2. What's the real solution? (i.e. something I could contribute)
  3. How does this intersect with @AndresGuedez's work?

/cc @lrouquette @bryanlatten

@phylake
Copy link
Author

phylake commented Aug 14, 2019

This is envoy_inuse_space for heap dumps taken until we hit the 30GiB steady state

image

@adrocknaphobia
Copy link

@atrifan ☝️

@mattklein123 mattklein123 added enhancement Feature requests. Not bugs or questions. help wanted Needs help! labels Aug 14, 2019
@mattklein123
Copy link
Member

cc @htuch @fredlas @AndresGuedez @stevenzzzz

I think the real solution here is to allow the RDS watches to point to a single subscription and single shared route config. I think this is probably not that hard given the work that @fredlas just did and the work that @stevenzzzz is doing right now but I will let them weigh in.

@mattklein123 mattklein123 added this to the 1.12.0 milestone Aug 14, 2019
@AndresGuedez
Copy link
Contributor

I think the real solution here is to allow the RDS watches to point to a single subscription and single shared route config.

Agreed. This is one of the primary goals of the Config Provider framework that was introduced as part of the SRDS work.

Once the SRDS implementation is complete, we are planning to transition RDS to use the framework as well.

@mattklein123
Copy link
Member

Sounds good I will assign this over to @stevenzzzz for now.

@lizan
Copy link
Member

lizan commented Aug 14, 2019

I think the real solution here is to allow the RDS watches to point to a single subscription and single shared route config.

@mattklein123 It does point to a single subscription but different route config due to #3960 to fix #3953. I believe this is already in the consideration of @AndresGuedez 's Config Provider framework.

#7870 could fix this from the other side by not having multiple HCM for different SNI.

@atrifan
Copy link
Contributor

atrifan commented Aug 14, 2019

I think that what @AndresGuedez said is the only viable solution and there is no place for a “quick fix” or a “work-around”. Reloads, hot reloads, gracefull reloads and other in-place modifications need to happen without affecting other ongoing clients - this is the main responsability of a proxy so right now keeping a copy of the RDS for each filter_chain (which you can look at as a middleware of that request) is by design a safety mechanism so you don’t break other request handlings that are ongoing. Also keeping a copy makes sure that you update each filter chain when you are ready, that beeing later then another filter_chain or earlier. In general - other proxies that support gracefull updates (you can check out nginx as well) have a big problem with the memory footprint - in different phases though or diferrent situations.

@mattklein123
Copy link
Member

@lizan yeah I think we should be able to get back to a shared route config for a shared subscription. I think this is also related to #7902 to which @stevenzzzz is working on.

@atrifan for identical route configs which point to the same named RDS subscription we can definitely make it shared. That is planned.

@htuch
Copy link
Member

htuch commented Aug 15, 2019

@stevenzzzz and I were discussed moving RDS to the config provider framework today. This might need to happen prior to SRDS landing due to some complexities around the lifetime management that are trickier than expected in #7451. @stevenzzzz is analyzing complexity of different approaches here last we spoke.

We definitely need to go sharing for memory use reasons, but at the same time, we need to be very careful how we structure this. There is a lot of lifetime and ownership complexity in RDS/SRDS that we need to make sure is maintainable and grokkable by developers.

@stevenzzzz
Copy link
Contributor

yeah, migrate RDS to the config-provider-framework is on my radar.
Will do that after the SRDS impl.

@mattklein123
Copy link
Member

I believe this is fixed by #9209

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions. help wanted Needs help!
Projects
None yet
Development

No branches or pull requests

8 participants