Skip to content

File based query cache#2713

Merged
spawnia merged 30 commits into
masterfrom
feature/file-based-query-cache
Sep 10, 2025
Merged

File based query cache#2713
spawnia merged 30 commits into
masterfrom
feature/file-based-query-cache

Conversation

@thekonz
Copy link
Copy Markdown
Collaborator

@thekonz thekonz commented Aug 27, 2025

  • Added or updated tests
  • Documented user facing changes
  • Updated CHANGELOG.md

Changes

Just like the schema cache, now the query cache can be picked up by opcache.

Breaking changes

None expected.

@thekonz thekonz marked this pull request as ready for review August 27, 2025 17:57
@thekonz thekonz requested a review from spawnia August 28, 2025 07:54
@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Sep 8, 2025

Hi @thekonz, thank you for contributing this feature. I am installing it in one of our projects right now for testing and will provide a thorough review together with some performance measurements soon.

Comment thread src/LighthouseServiceProvider.php
Comment thread src/Cache/QueryCache.php Outdated
Comment thread src/Cache/QueryCache.php Outdated
Comment thread src/Console/ClearQueryCacheCommand.php Outdated
Comment thread src/lighthouse.php Outdated
@spawnia spawnia added enhancement A feature or improvement performance Fix or optimization of performance labels Sep 8, 2025
@thekonz
Copy link
Copy Markdown
Collaborator Author

thekonz commented Sep 8, 2025

hi, thanks for reviewing! currently sick with covid. will get back to you later this week 😷

@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Sep 8, 2025

I hope you get better soon, no rush on this one :)

Did some local testing which was promising! The file based cache consistently worked worked out to be under 1ms, whereas no caching took 11ms and database caching took 2-3ms.

@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Sep 8, 2025

Testing in our integration environment looks promising too! In a particularly large query, using this shaved ~15ms off the execution time.

@thekonz
Copy link
Copy Markdown
Collaborator Author

thekonz commented Sep 8, 2025

Great results!
I remember that implementing the file based schema cache reduced execution time a bit as well, but mostly it reduced memory usage, because the value was already in opcache.
Have you checked out the difference in memory usage? Surely it won't be as substantial as the schema cache, but for a big query it should be nice.

Comment thread docs/master/performance/query-caching.md
Comment thread src/lighthouse.php
Comment thread src/Cache/QueryCache.php
@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Sep 10, 2025

@thekonz Anything else before I merge and release?

@thekonz
Copy link
Copy Markdown
Collaborator Author

thekonz commented Sep 10, 2025

nope, looks good

@spawnia spawnia merged commit 780da32 into master Sep 10, 2025
62 checks passed
@spawnia spawnia deleted the feature/file-based-query-cache branch September 10, 2025 12:38
@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Sep 10, 2025

Released with https://github.com/nuwave/lighthouse/releases/tag/v6.63.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A feature or improvement performance Fix or optimization of performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants