Skip to content

WiP admin: Add paging UI to admin stats page.#19413

Closed
jmarantz wants to merge 6 commits intoenvoyproxy:mainfrom
jmarantz:stat-paging
Closed

WiP admin: Add paging UI to admin stats page.#19413
jmarantz wants to merge 6 commits intoenvoyproxy:mainfrom
jmarantz:stat-paging

Conversation

@jmarantz
Copy link
Copy Markdown
Contributor

@jmarantz jmarantz commented Jan 6, 2022

Commit Message: Proof-of-concept mega PR to make it possible to efficiently page through stats. It incorporates a bunch of concepts which should be broken out into their own PRs and reviewed:

  • an improvement to the HTML UI for stats page to allow filling in form-fields for query params
  • a change in representation in the stats allocator to an absl::btree_set to allow for ordered traversal
  • New APIs in Stats::Allocator and Stats::Store to enable paging through stats in forward/backward order
  • A few random bug-fixes and API improvements (e.g. string->string_view)

The benefit is that a user can visit the stats page for a very large configuration without blowing up Envoy CPU/Memory or their browser.

The PR still has a scaling problem that if you use a regex that doesn't match anything, the admin page will iterate over every stat, consuming potentially half a second of CPU on the main thread if there are 1M stats (I need to re-measure). We can make the regex filtering smarter if it's a prefix match (e.g. ^foo) by constraining the search using the set's lower_bound and upper_bound APIs. However I think this will still be much better than it was because it won't need to buffer anything. The current impl starts by making a giant vector of all counters.

Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
Fixes: #18675
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@repokitteh-read-only
Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #19413 was opened by jmarantz.

see: more, trace.

Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Copy Markdown
Contributor Author

jmarantz commented Jan 6, 2022

@ggreenway FYI

Signed-off-by: Joshua Marantz <jmarantz@google.com>
@jmarantz
Copy link
Copy Markdown
Contributor Author

jmarantz commented Jan 7, 2022

I'm closing this as an existing perf test revealed an extreme slowdown due to the transition from flat_hash_set to btree_set. The containers themselves were not the issue, but btree_set forces a lot more comparisons and that becomes the bottleneck. I am back to focusing on scope as a way to have a UI iterate to peruse millions of stats without CPU hiccups or long-held locks.

@jmarantz
Copy link
Copy Markdown
Contributor Author

Note -- if this PR is ever revived it will be much easier now, as stats_request.cc supports an efficient ordered traversal through all stats. It's used now for chunked output but the chunks could be turned into pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stats: reduce browser and server memory/cpu bursts when viewing stats from admin

1 participant