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: dashboard performance #28609

Merged
merged 9 commits into from
May 28, 2024
Merged

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented May 20, 2024

SUMMARY

This PR introduces a substantial performance improvement to the dashboard list page.
We have noticed that json_metadata and position_json can contain huge payloads on dashboards that contain a large amount of charts (hundreds). This can heavily impact performance.

The easier path would be to just remove those columns from list_columns on the backend, but thats a breaking change. Also thumbnail_url uses position_json and json_metadata to compute the MD5 digest. So currently it's not possible to improve the REST API performance itself by default.

it's possible on FAB to just request the columns we want using the columns query parameter, but the SQL selected columns would still use the configures list_columns or list_select_columns. On 4.5.0 I've introduced a new query parameter named select_columns that works exactly like columns but will actually on query the requested columns (without never "escaping" the list_columns set configured on the backend, for security reasons).

Using the example dashboards:

Requesting just the columns we need defined on this PR, avg API response is ~16ms

Using the API by default (backend defined columns), avg API response is ~120ms

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 70.29%. Comparing base (76d897e) to head (f366583).
Report is 233 commits behind head on master.

Files Patch % Lines
...frontend/src/features/dashboards/DashboardCard.tsx 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #28609      +/-   ##
==========================================
+ Coverage   60.48%   70.29%   +9.81%     
==========================================
  Files        1931     1949      +18     
  Lines       76236    77635    +1399     
  Branches     8568     8738     +170     
==========================================
+ Hits        46114    54577    +8463     
+ Misses      28017    20930    -7087     
- Partials     2105     2128      +23     
Flag Coverage Δ
hive 49.07% <ø> (-0.10%) ⬇️
javascript 57.87% <86.66%> (+0.16%) ⬆️
mysql 77.16% <ø> (?)
postgres 77.29% <ø> (?)
presto 53.61% <ø> (-0.19%) ⬇️
python 83.53% <ø> (+20.05%) ⬆️
sqlite 76.74% <ø> (?)
unit 59.01% <ø> (+1.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size bot added size/L and removed size/S labels May 21, 2024
@dpgaspar dpgaspar marked this pull request as ready for review May 21, 2024 10:11
@dosubot dosubot bot added the dashboard:performance Related to Dashboard performance label May 21, 2024
@dpgaspar dpgaspar requested a review from eschutho May 21, 2024 10:54
@eschutho
Copy link
Member

/testenv up

Copy link
Contributor

@eschutho Ephemeral environment spinning up at http://35.95.35.109:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@@ -15,8 +15,6 @@ apispec[yaml]==6.3.0
# via flask-appbuilder
apsw==3.42.0.1
# via shillelagh
async-timeout==4.0.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just noting that this particular pinned dep has been flickering, meaning pip-compile-multi isn't as deterministic as I'd like for it to be, for reasons I don't really understand

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. It's nice to be able to specify the columns needed for the list view

@eschutho eschutho merged commit 87110eb into apache:master May 28, 2024
35 checks passed
@eschutho eschutho deleted the fix/dashboard-perf branch May 28, 2024 20:09
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

EnxDev pushed a commit to EnxDev/superset that referenced this pull request May 31, 2024
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
Co-authored-by: Joe Li <joe@preset.io>
eschutho pushed a commit that referenced this pull request Jun 5, 2024
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
Co-authored-by: Joe Li <joe@preset.io>
(cherry picked from commit 87110eb)
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
Co-authored-by: Joe Li <joe@preset.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dashboard:performance Related to Dashboard performance size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants