Skip to content
Snippets Groups Projects
Unverified Commit 870e8530 authored by Braden Shepherdson's avatar Braden Shepherdson Committed by GitHub
Browse files

[perf] Add caching on `dashboard_load_id`; reusable MetadataProviders (#45050)

**MetadataProvider cache**

The reusable MetadataProviders is a generally useful thing - within some
dynamic scope like an API request, a `clojure.core.cache` instance can
be provided as `lib.metadata.jvm/*metadata-provider-cache*`, and that
will be used to cache the provider for each `database-id`.

Reusing those providers can significantly reduce appdb traffic,
re-fetching the same metadata in different `MetadataProvider`
instances.

**Dashboard loads**

The FE can supply `?dashboard_load_id=uuid_string` on requests for a
dashboard load:

- `/api/dashboard/:id`
- `/api/dashboard/:id/query_metadata`
- `/api/dashboard/:id/dashcard/:dashcard_id/card/:card_id/query`

That provides a good cache key across that burst of N+2 API requests
that are part of a single load. Currently it is used for two things:

- Caching `get-dashboard` (used by the first two requests)
- Selecting the `clojure.core.cache` for `*metadata-provider-cache*`

Both use a TTL of 10 seconds, which is generally enough for the first
screenful of a dashboard load, if not the whole thing. (Browsers will
only issue a handful of requests at once, so a few long-running queries
might delay later parts of the dashboard from loading until after the
TTL expires.)
parent 0d2b4b06
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment