-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
Caching charts in Superset #7340
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Designing a simple cache system, I'll like to see this list of things:
In #7032 and apache-superset/superset-ui#119, you introduced 2 layers of caching: client-side cache (conditional requests) and server cache. Let's see how it works (as of today in client-side cache and conditional requests:
server-side cache:
First, using request url as client-side cache key is problematic. For example, user A changed slice_1 by added a filter and saved it. Then User B won't see this change until his browser cache expired. I think #7255 is trying to resolve this issue, but it can not resolve the root cause. In #7255 the issue is exposed by user changing viz_type, so the fix is to add viz_type parameter as client-side cache key. But what if chart's other parameter get updated and saved with same chart id? Furthermore, what if browser cache is full? My concern is, can this client-side cache scale for many, large dashboard case? There are a few issues in switching between GET and POST methods (I think you probably fix them in #7319 by invalidate client-cache?):
Last but not least, I have some concerns on security:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue |
Summary
This document describes the strategies for caching responses and invalidating them in Superset. They’re current implemented in the following PRs:
I’m sharing this since it seems we didn’t have enough time to discuss the changes in the first PR.
Terminology
SupersetClient
in Feat: improve caching apache-superset/superset-ui#137.GET vs. POST
Chart
component is mounted). The GET request has the slice id, the visualization type and, in the case of dashboards, any additional filters that the dashboard might apply.Scenarios
Single user in Explore view
explore_json
with form dataexplore_json
for each clickexplore_json?form_data={“slice_id”:1}
Single user Explore/Dashboard interaction
Multiple user Explore/Dashboard interaction
Not that we can overcome the staleness problem described in (3) by making the dashboard component force refresh slices that were changed after the response was cached in the browser. The payload received by the dashboard has a
changed_on
attribute for each slice, and the responses in the client cache have the timestamp when the requests were made. @graceguo-supercat, I think this addresses your concern?Performance
I measured dashboard loading times before and after the GET requests were introduced, using the top 10 dashboards at Lyft. The average improvement was 20%, and the biggest improvement observed was 60%.
Dashboard 1
Dashboard 2
Dashboard 3
Dashboard 4
Dashboard 5
Dashboard 6
Dashboard 7
Dashboard 8
Dashboard 9
Dashboard 10
Note: improvement was computed by dropping the highest/lowest values and taking the average.
The text was updated successfully, but these errors were encountered: