-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
stats: Use SymbolTable API for creating and representing stat names. #6161
Conversation
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
…mbol tables. Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
…s impacting microbenchmarks. Signed-off-by: Joshua Marantz <[email protected]>
…lls. Helped but not too much. Signed-off-by: Joshua Marantz <[email protected]>
…ing each element. Signed-off-by: Joshua Marantz <[email protected]>
…temp creation. Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
…, etc. Signed-off-by: Joshua Marantz <[email protected]>
…oxy#6161. Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
) * Plumb through symbol tables everywhere. Pulled from #6161. Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
Signed-off-by: Joshua Marantz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/wait-any
…strix. Signed-off-by: Joshua Marantz <[email protected]>
…t most call-sites outside of stats to use. Signed-off-by: Joshua Marantz <[email protected]>
/retest |
🔨 rebuilding |
/retest |
🔨 rebuilding |
/retest |
🔨 rebuilding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? delete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, yes. WDYT about a quick follow-up for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind; deleted.
Signed-off-by: Joshua Marantz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]> Signed-off-by: Jeff Piazza <[email protected]>
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.MemoryWithoutTls
andHeapStatsThreadLocalStoreTest.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