superset: Catalog permission syncs severely degrades dashboard import performance
Bug description
The addition of catalogs in Superset 4.1.0 has resulted in significantly worse dashboard import performance. We’re seeing dashboard import time increase from <10 seconds to >3 minutes.
We’re currently using Postgres (RDS) to serve embedded dashboards in our multi-tenanted application. As we are multi-tenanted, we have one catalog/database per tenant.
When importing dashboards, Superset now iterates through all catalog names to sync permissions. As we have hundreds of catalogs/dbs, this sync adds a couple of minutes per import.
We need to import a default set of dashboards for each tenant (with their own unique set of datasets pointing to their individual databases). The sync permission step needs to run for each dashboard import.
This results in NxN syncs (in our case, N=200, so on the order of 40k syncs). So, the time to upload dashboards for all our tenants has exploded from 30-60 minutes to over 10 hours.
Expected Behavior
I see there already exists a flag to disable catalog discovery - allow_multi_catalog. I propose that if this flag is set to false, then Superset should only sync permissions for the default catalog.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- I have searched Superset docs and Slack and didn’t find a solution to my problem.
- I have searched the GitHub issue tracker and didn’t find a similar bug report.
- I have checked Superset’s logs for errors and if I found a relevant Python stacktrace, I included it here as text in the “additional context” section.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 18 (18 by maintainers)
thanks for the additional context, @arafoperata 🙏
Tentative solution here: https://github.com/apache/superset/pull/33000/files#diff-8eeb4739ec1b8988500d5a48abf1de2624ce370a4283a14f9ecebd2e081e3a48R200-R214