stats: Use SymbolTable API for creating and representing stat names.#6161
stats: Use SymbolTable API for creating and representing stat names.#6161jmarantz merged 52 commits intoenvoyproxy:masterfrom
Conversation
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…mbol tables. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…s impacting microbenchmarks. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…lls. Helped but not too much. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…ing each element. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…temp creation. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…, etc. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…oxy#6161. Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
mattklein123
left a comment
There was a problem hiding this comment.
Flushing out some comments. The main thing to sort out is merge order between this and the hot restart change. My personal preference is to land the hot restart change first since it's pretty close but will let you and @fredlas sort it out.
The other thing I would like to figure out is how to avoid the manual memory management that callers need to do here. I think we can provide some type of smart pointer, RAII guard, etc. to handle this?
Thank you!
/wait
…ons. (#6688) Per @ambuc's comment on #6161 I think it would be better to keep a log of the memory consumed by stats, and also use exact comparisons. That way we can get historical perspective into the relative impact of adding new stats or families of stats. Risk Level: low, but could cause more changes to this one test. Testing: just this one test. Docs Changes: n/a Release Notes: n/a Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
…strix. Signed-off-by: Joshua Marantz <jmarantz@google.com>
…t most call-sites outside of stats to use. Signed-off-by: Joshua Marantz <jmarantz@google.com>
|
/retest |
|
🔨 rebuilding |
|
/retest |
|
🔨 rebuilding |
|
/retest |
|
🔨 rebuilding |
mattklein123
left a comment
There was a problem hiding this comment.
LGTM with one thing. Very cool stuff!
/wait
| // can complete properly, even if the tag values are partially truncated. | ||
| std::string tag_extracted_name = parent_.getTagsForName(name, tags); | ||
| TagExtraction extraction(parent_, name); | ||
| // std::shared_ptr<StatType> stat = make_stat(parent_.alloc_, extraction.truncatedStatName(), |
There was a problem hiding this comment.
Ouch, yes. WDYT about a quick follow-up for that?
There was a problem hiding this comment.
never mind; deleted.
Signed-off-by: Joshua Marantz <jmarantz@google.com>
mattklein123
left a comment
There was a problem hiding this comment.
Sorry, follow up would have been fine. Very nice!
|
/retest |
|
🔨 rebuilding |
…nvoyproxy#6161) * Use SymbolTable API for creating and representing stat names. Signed-off-by: Joshua Marantz <jmarantz@google.com> Signed-off-by: Jeff Piazza <jeffpiazza@google.com>
Description: This PR takes a significant step toward resolving #3585 and #4196 by integrating the symbol table API natively into heap-based stats. There is no real symbol-table live in the code yet. The benefit of this PR is that it allows us to begin a series of PRs throughout the codebase to use the symbol-table API to lookup/create stats rather than raw strings.
In this PR we use a fake symbol table implementation, which reduces the functional risk, but it also doesn't yield 100% of the memory benefit yet.
It does yield significant benefit though -- because it changes the storage model for tags and tag-extracted names to store them all contiguously in a block of memory rather than as discrete std::string objects. This alone reduces memory usage about 25% based on
HeapStatsThreadLocalStoreTest.MemoryWithoutTlsandHeapStatsThreadLocalStoreTest.MemoryWithTls.The next step is a series of fairly small PRs that will change various subsystems to use this interface rather than specifying stats by string literals. Once this is done, with the constituent symbols in most cases allocated at startup time rather than ad-hoc, the symbol-table implementation can be switched out from a fake version (that just uses raw strings underneath) into the real version, where there is sharing of symbols.
Risk Level: medium -- this is a pretty large refactor. There is some functional risk as well as performance risk. However this is intended to be an essentially non-functional refactor.
Testing: //test/...
Docs Changes: Updated stats.md to reflect the plan.
Release Notes: n/a