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

POC: Massive performance boost experiment with no full page reloads between renders #199

Closed
wants to merge 3 commits into from

Conversation

torkelo
Copy link
Member

@torkelo torkelo commented Dec 10, 2020

Fixes #124

This is a very hacky POC to explore the biggest potential avenue for performance improvement, getting rid of full-page reloads between image renderings.

The first image takes the normal amount of time: 2-3 seconds

After that, the image renderings take about 200 - 300ms (assuming the panel queries are very fast)

This needs a lot more work to be production-ready. There could be big security issues with this approach that needs to be investigated. And more complex logic that validates that the rendered panel is for the same instance and org as the last render request, need a way to cache browser pages per org.

Todo

  • Address security concerns
  • Cache pages per org & user
  • Every 50x render (or some number) do a full page reload to avoid memory leaks causing issues
  • Fix rendering different panel on same dashboard (should be easy)
  • Need not reuse for concurrent requests
  • Needs updates to SoloPanelPage to support navigating between dashboards (needs cleanup), and panel on the same dashboard.

@xf-
Copy link

xf- commented Dec 10, 2020

nice workaround 👍

@ryantxu
Copy link
Member

ryantxu commented Feb 9, 2022

The blocker with this approach is authentication managed with renderKey -- since it is a cookie (and must be a cookie) we can't share a page/context across multiple requests with different users.

In #314 @ArturWierzbicki has extended the concurrency mode so that requests with the same render key will keep the same session/cache etc. But this will not yet help the general case.

@ArturWierzbicki
Copy link
Contributor

The blocker with this approach is authentication managed with renderKey -- since it is a cookie (and must be a cookie) we can't share a page/context across multiple requests with different users.

In #314 @ArturWierzbicki has extended the concurrency mode so that requests with the same render key will keep the same session/cache etc. But this will not yet help the general case.

Created a working PoC in grafana-core for the general case, ie. when a single user issues multiple render requests in a short time window.
The implementation is pretty simple - it leverages the new contextPerRenderKey mode and persists the combination of renderKey/userId/orgId/orgRole in the DB. Keys are valid for 10 minutes unless refreshed via a new render request from the same user.

@CLAassistant
Copy link

CLAassistant commented Jun 15, 2022

CLA assistant check
All committers have signed the CLA.

@torkelo torkelo closed this May 14, 2024
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.

Image renderer plugin: rendering horribly slow
5 participants