Skip to content
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

Fix freezes and further improve performance of event views #3301

Closed
wants to merge 10 commits into from

Conversation

kschiffer
Copy link
Contributor

Summary

This PR fixes lags, freezes and improves the performance of the event views by introducing various performance optimizations.

Closes #2887

Changes

  • Speed up render times of <Event /> component
    • Introduce <SafeInspector.Light /> to avoid big overheads of the regular safe inspector when rendered inside events
    • Replace expensive usage of getByPath() object prop utility with vanilla implementation
    • Replace expensive usage of <DateFormat /> with simple vanilla implementation
    • Make event error boundary a PureComponent
  • Improve performance of store logic
    • Introduce an event limit to avoid memory issues (currently set to 2000 events, ~3MB)
    • Introduce a buffered dispatch to the event store, to debounce expensive processing and store update operations, which caused significant lag in very active event streams (especially when scrolling the list)
      • Refactor affected store logic to handle multiple events per dispatch
  • Other tweaks
    • Slightly adjust the overscan count for react-window
    • Fix a small styling issue of the <SafeInspector />
    • Remove superfluous top-level error checks for end devices, gateways and organization (missed doing that in Event fixes and improvements (Console) #3229)

Testing

Manual testing in staging environment and injected redux state

Regressions

This might introduce issues regarding

  • Event list integrity
  • Display issues of the data previews

Notes for Reviewers

From my own profiling and testing, this improves the stability and speeds up the performance of the event view significantly. Regarding performance optimization there's obviously a never-ending room for further tweaks, though I think this is the best trade-off between reasonable performance optimization and avoiding adding too many obtrusive code changes.

Regarding 2000 event limit: this seemed like a sane limitation to me for now, at which the console still runs smoothly. We might want to fine-tune this value later when we have more feedback and metrics. Generally, it's important to establish for the user that the Console event view is not the correct place to source long-term event data.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@kschiffer kschiffer added c/console This is related to the Console performance Something is slow or takes too much CPU/Memory/... technical debt Not necessarily broken, but could be done better/cleaner ui/web This is related to a web interface needs/backport Needs to be backported to previous versions that are maintained labels Sep 30, 2020
@kschiffer kschiffer added this to the September 2020 milestone Sep 30, 2020
@kschiffer kschiffer self-assigned this Sep 30, 2020
@github-actions github-actions bot added the documentation This involves writing user documentation label Sep 30, 2020
@htdvisser htdvisser modified the milestones: September 2020, October 2020 Oct 1, 2020
@kschiffer kschiffer force-pushed the fix/2887-event-performance branch from f88bf13 to 302502b Compare October 1, 2020 10:21
@kschiffer
Copy link
Contributor Author

Closing to split up into individual PRs.

@kschiffer kschiffer closed this Oct 6, 2020
@kschiffer kschiffer deleted the fix/2887-event-performance branch October 7, 2020 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console This is related to the Console documentation This involves writing user documentation needs/backport Needs to be backported to previous versions that are maintained performance Something is slow or takes too much CPU/Memory/... technical debt Not necessarily broken, but could be done better/cleaner ui/web This is related to a web interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data views slow down and freeze after receiving many events
2 participants