-
Notifications
You must be signed in to change notification settings - Fork 155
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
Support new concurrency mode: contextPerRenderKey
#314
Conversation
…ana-image-renderer into browser-per-domain-concurrency
27c3af2
to
1e59136
Compare
renderer.mp4 |
…derer into browser-per-domain-concurrency � Conflicts: � dev.json � package.json � src/browser/browser.ts � src/types.ts � yarn.lock
contextPerRenderKey
|
Would you be prepared to help maintaining that fork? |
@jongyllen yeah of course! |
@AgnesToulet as discussed, I have rollbacked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Left a few comments and concerns.
src/browser/clustered.ts
Outdated
maxConcurrency: this.clusteringConfig.maxConcurrency, | ||
timeout: this.clusteringConfig.timeout * 1000, | ||
workerCreationDelay: 1000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be used only if needed as it could decrease performance in some cases.
Also, as discussed, I think it would be nice to update the documentation that is managed here: https://github.com/grafana/grafana/blob/main/docs/sources/image-rendering/_index.md Feel free to reach out to me or @achatterjee-grafana if you have any doc-related question. |
Co-authored-by: Agnès Toulet <[email protected]>
Co-authored-by: Agnès Toulet <[email protected]>
Co-authored-by: Agnès Toulet <[email protected]>
@AgnesToulet discussed the docs situation with @achatterjee-grafana and settled on adding draft docs right now and merging them into the main file once we release the previews. PR: https://github.com/grafana/grafana/pull/45490/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Let's merge this 🎉
PR adds support for a new concurrency mode,
contextPerRenderKey
which improves the performance of the dashboard crawl process without negatively affecting the existing use cases.With
contextPerRenderKey
mode enabled, image-renderer will reuse the same browser context (created via CDP - https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createBrowserContext) for all requests with the samedomain
andrenderKey
within a certain timeframe.The dashboard crawler reuses the same
renderKey
for all renders within a single crawl thanks to the concept of RenderingSession. All other use cases create a uniquerenderKey
for each request, causingcontextPerRenderKey
mode to behave exactly the same as the existingcontext
modeThe main benefits are:
browserContext
vs new page in existingbrowserContext
browserContext
is a separate browser windowShared JS cache is by far the biggest deal. Tests done in local env with 94 dashboards and 6 crawler threads - results are the average of 3 runs (low variance)
to test:
main
grafana branchdashboardPreviews
feature flagcustom.ini
configstart