fix(top): handle UI events separately to prevent UI freeze#25604
Conversation
Transition to gRPC for API introduced a higher number of events, causing high load in state updater when many components are present, blocking the UI events from being sent to the channel (because it gets full fast). This introduces a separate channel for UI events to ensure they get a chance to be processed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8478de4d84
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dba39cc8c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Hi @esensar, thank you for this fix. This made me think a bit more about the top dashboard design. We always want to render the latest state, but we are unnecessarily rendering all snapshots in order (received via a bounded FIFO mpsc channel).
Example:
We are queuing states: [A,B,C,D]
We render: state A -> state B -> state C -> state D
But we only need to render state D.
Does the above make sense?
We can probably fix this by using a watch::channel, so metric updates can coalesce and the renderer always observes the freshest state.
Yes, it makes sense. I noticed that too while working on this, but I wanted to limit the scope of the fix, so I handled it on UI side.
That makes sense - I did that myself, but using |
4581e49 to
b04028e
Compare
|
I have changed it to use I have tested this and it has the same behavior like my previous code, so this is better to keep. |
Summary
Transition to gRPC for API introduced a higher number of events, causing high load in state updater when many components are present, blocking the UI events from being sent to the channel (because it gets full fast). This introduces a separate channel for UI events to ensure they get a chance to be processed.
Vector configuration
Configuration with a high number of components (from #24355):
How did you test this PR?
Ran vector with the above configuration and ran
vector topseparately. Without this patch, pressing?or any other keybind (other thanq) would freeze top completely. After this patch the UI event gets processed as expected.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
vector top#24355Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.