router icon indicating copy to clipboard operation
router copied to clipboard

Allow disabling introspection responses going to cache

Open smyrick opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. Currently, introspection queries and their response data is saved to the cache, which also populated in Redis.

https://github.com/apollographql/router/blob/615b74d9cec12d2ea94109335b8321fea73d688a/apollo-router/src/introspection.rs#L79

If I have an extremely large schema and I have clients making slightly different introspection queries this can start sending lots of data to my Redis instance and eating up performance, bandwith, and storage

Describe the solution you'd like Allow configuring or disabling if introspection responses are cached or not

Enabled cache

supergraph:
  introspection:
    enabled: true
    cache: 
      in_memory:
        limit: 1
      redis:
        urls: [ "redis://localhost:6379" ]

Disabled cache

supergraph:
  introspection:
    enabled: true
    cache: false # Not sure what is better here. I think default should be cache on, so how do we turn it off?
    cache: 
      in_memory:
        enabled: false
      redis:
        enabled: false

Describe alternatives you've considered There is no control over this today. I need to enforce that introspection is all the same or I can disable it entirely

supergraph:
  introspection: false

Additional context Maybe as part of the issue https://github.com/apollographql/router/issues/4608 we can add more features

OR

We could lock down introspection to only 1 predefined operation: https://github.com/apollographql/router/issues/4871

smyrick avatar Mar 26 '24 22:03 smyrick

Introspection is not computationally expensive. I wonder if we’d be better off not caching it at all.

SimonSapin avatar Apr 16 '24 12:04 SimonSapin

We may have only cached it previously because it was going through the router-bridge.

abernix avatar Apr 19 '24 10:04 abernix

I'm particularly unsure why we would ever cache it in Redis.

abernix avatar Jun 07 '24 11:06 abernix

This issue is already causing OOM problems and could affect all users that use introspection. It would be great if this can be addressed as soon as possible, especially if it's a quick fix.

Samjin avatar Jun 17 '24 16:06 Samjin