Skip to content

in memory and Redis cache configuration#2155

Merged
Geal merged 7 commits intodevfrom
geal/caching-configuration
Nov 28, 2022
Merged

in memory and Redis cache configuration#2155
Geal merged 7 commits intodevfrom
geal/caching-configuration

Conversation

@Geal
Copy link
Contributor

@Geal Geal commented Nov 24, 2022

Fix #2075

This implements @BrynCooke's suggestion from #2075. I did not add the option for introspection because it did not feel very useful, and would be a breaking change for the configuration format. If we really need to cache introspection responses, that could be done as part of the whole response caching feature.

Example configuration:

supergraph:
  apq:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]
  query_planning:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]

@Geal Geal marked this pull request as ready for review November 24, 2022 16:40
@github-actions

This comment has been minimized.

@Geal Geal requested a review from StephenBarlow as a code owner November 28, 2022 11:02
@Geal Geal requested review from a team, bnjjj and garypen and removed request for a team November 28, 2022 11:03
Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

Great. It's nice to see ROUTER_PLAN_CACHE_LIMIT removed.

Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

Actually, can we put the entire cache section in experimental for now?
cache->experimental_cache

@Geal
Copy link
Contributor Author

Geal commented Nov 28, 2022

Actually, can we put the entire cache section in experimental for now?

sure, makes sense

@Geal
Copy link
Contributor Author

Geal commented Nov 28, 2022

Actually, can we put the entire cache section in experimental for now? cache->experimental_cache

done in a70a05e

Copy link
Contributor

@BrynCooke BrynCooke left a comment

Choose a reason for hiding this comment

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

LGTM

@Geal Geal requested a review from BrynCooke November 28, 2022 13:17
@Geal Geal merged commit ad6e931 into dev Nov 28, 2022
@Geal Geal deleted the geal/caching-configuration branch November 28, 2022 13:38
#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub(crate) struct Apq {
pub(crate) experimental_cache: Cache,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub(crate) experimental_cache: Cache,
#[serde(rename = "experimental_cache")]
pub(crate) cache: Cache,

It will be one line change if we stabilize it

#[derive(Debug, Clone, Default, Deserialize, Serialize, JsonSchema)]
#[serde(deny_unknown_fields)]
pub(crate) struct QueryPlanning {
pub(crate) experimental_cache: Cache,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need 2 different structs instead of one ?

garypen pushed a commit that referenced this pull request Nov 30, 2022
Fix #2075

This implements @BrynCooke's suggestion from #2075. I did not add the
option for introspection because it did not feel very useful, and would
be a breaking change for the configuration format. If we really need to
cache introspection responses, that could be done as part of the whole
response caching feature.

Example configuration:

```yaml
supergraph:
  apq:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]
  query_planning:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]
```
@BrynCooke BrynCooke added this to the v1.5.0 milestone Dec 3, 2022
@garypen garypen added this to the v1.5.0 milestone Dec 5, 2022
@BrynCooke BrynCooke modified the milestone: v1.5.0 Dec 5, 2022
@BrynCooke BrynCooke mentioned this pull request Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

configuration for external caching

5 participants