Skip to content

Improve resource subscription performance and safety#2665

Merged
JamesNK merged 4 commits intomainfrom
jamesnk/debouncing
Mar 7, 2024
Merged

Improve resource subscription performance and safety#2665
JamesNK merged 4 commits intomainfrom
jamesnk/debouncing

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Mar 6, 2024

Addresses #2496

The goal of these changes is to make the dashboard client update the UI at the interval it wants to (max 10 times a second) and not the interval that external data sources force upon it.

  • Change resource update stream to always return a list of updates. This allows multiple changes to be applied to the UI before re-rendering. I made the underlying stream return a list rather than just rely on GetBatchesAsync because the first write to the channel will trigger to reader. There is no write then flush.
  • Add minReadInterval to GetBatchesAsync. This puts a limit on how often data is returned. If the UI is updating frequently this will cause fewer, bigger updates. Prevent UI re-rendering too much.
  • Change DashboardClient.SubscribeConsoleLogs to read from gRPC and write to a channel, then read from the channel in batches. Allows it to take advantage of improvement to GetBatchesAsync.

Telemetry subscriptions will be in a separate PR. Telemetry subscriptions are different in that they use callbacks instead of async streams. The idea will be the same, limit callbacks to a min interval, but the implementation will be different.

@JamesNK JamesNK changed the title Improve subscription updates performance and safety Improve resource subscription performance and safety Mar 6, 2024
@JamesNK JamesNK force-pushed the jamesnk/debouncing branch from e322595 to e40d928 Compare March 6, 2024 07:45
@JamesNK JamesNK merged commit 768b4de into main Mar 7, 2024
@JamesNK JamesNK deleted the jamesnk/debouncing branch March 7, 2024 05:55
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants