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

Cache introspection query #605

Closed
StarpTech opened this issue Mar 6, 2024 · 12 comments
Closed

Cache introspection query #605

StarpTech opened this issue Mar 6, 2024 · 12 comments
Labels
enhancement New feature or request

Comments

@StarpTech
Copy link
Contributor

StarpTech commented Mar 6, 2024

Component(s)

router

Is your feature request related to a problem? Please describe.

As a user, I would like to have fast introspection queries. A schema can be very large and currently, it can take several seconds until the router has prepared and respond to the introspection query request. We're talking about scenarios with more 10K+ lines of GraphQL schemas and 5K+ of types.

We can speed this up by caching the entire response in-memory. A schema can only be modified on router restart or after the router has polled an update from the CDN; otherwise, the schema remains stable, so a cache is very efficient in this case.

Describe the solution you'd like

Please cache the introspection query in memory after it has been computed by the engine. Return a response header e.g. X-WG-Introspection-Cache: true to signal that the introspection was served from the cache. When the schema is updated the cache is invalidated.

Requirements:

  • No CGO.
  • Functionality must be provided in separate Go modules with unit tests and integration test. See test suite.
  • The introspection request should still be tracked in metrics and analytics.

Describe alternatives you've considered

No response

Additional context

The introspection result is written here on the responseWriter interface.

Original issue: #155

@StarpTech StarpTech added the enhancement New feature or request label Mar 6, 2024
Copy link

github-actions bot commented Mar 6, 2024

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

@StarpTech
Copy link
Contributor Author

/bounty $100

@shashank40
Copy link

shashank40 commented Mar 6, 2024

Hey @StarpTech
Can you please assign the issue to me.
Even though, just after looking at the issue i cannot explain the full execution plan. But i am thinking around the lines of server-side caching in GraphQL.

We can expand on the discussion as i push more commits to my PR.

/attempt #605

Algora profile Completed bounties Tech Active attempts Options
@shashank40 1 bounty from 1 project
Python, TypeScript,
JavaScript
Cancel attempt

@StarpTech
Copy link
Contributor Author

StarpTech commented Mar 7, 2024

Hey @shashank40! Just wanted to let you know that the bounty is up for challenger for those who can independently solve the task. We're here to support you with a final review and architectural assistance, but it's designed to be a solo challenge. Given your tech background, it might be a tough nut to crack, especially because it demands a deep understanding of Go idioms to meet our high standards. Maybe consider this before diving in and spending your time on it.

@shashank40
Copy link

@StarpTech
Why not give it a try?
And for that part, i have worked briefly with go (and motivated to work more) in my daily job and so you see only python ts and js in my profile.

@StarpTech
Copy link
Contributor Author

StarpTech commented Mar 7, 2024

Of course, you can try it. Keep in mind, you're subject to a max attempt of 3. There is nothing to do here on our end.

@ologbonowiwi
Copy link

ologbonowiwi commented Apr 23, 2024

I have yet to learn the codebase, but I'd like to /attempt it.

Will drop the attempt in case I don't end up working on it

Algora profile Completed bounties Tech Active attempts Options
@ologbonowiwi 50 bounties from 6 projects
Rust, TypeScript,
Shell & more
Cancel attempt

Copy link

algora-pbc bot commented Apr 23, 2024

Note

The user @shashank40 is already attempting to complete issue #605 and claim the bounty. We recommend checking in on @shashank40's progress, and potentially collaborating, before starting a new solution.

@StarpTech
Copy link
Contributor Author

StarpTech commented Apr 24, 2024

Hi @ologbonowiwi, please keep in mind that bounties are standalone tasks (read the bounty conditions) because you get rewarded for them. If you want to contribute to OSS and believe you need a lot of assistance please don't attempt to the bounty but create a PR as usual. Thank you.

Copy link

algora-pbc bot commented Apr 30, 2024

@ologbonowiwi: Reminder that in 14 days the bounty will become up for grabs, so please submit a pull request before then 🙏

@ologbonowiwi
Copy link

Hi @StarpTech, you added the same links for engine and responseWriter. Is that right? If not, can you update the links on the issue's description?

@StarpTech
Copy link
Contributor Author

Hi @ologbonowiwi, we will shut down the bounty program. Sorry if you had any inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants