nuwave / lighthouse

A framework for serving GraphQL from Laravel
https://lighthouse-php.com
MIT License
3.37k stars 437 forks source link

Feature: cache validation rules #2603

Closed k0ka closed 2 months ago

k0ka commented 3 months ago

resolves #2018

Changes

Added possibility to cache query validation successful result. So the 2nd time the query would appear, most validator won't run against it.

Notes:

I also added different benchmarks. HugeRequestBench creates requests with a lot of simple fragments: 1, 10 and 100 for benchmark1, benchmark10 and benchmark100 respectively. Enabling validation cache improves execution time:

k0ka commented 2 months ago

Hello @spawnia,

do you have time to check this PR? It significantly improves speed and is disabled by default. So it won't break backward compatibility and we can gradually test it on real loads.

spawnia commented 2 months ago

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