Closed k0ka closed 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.
Released with https://github.com/nuwave/lighthouse/releases/tag/v6.45.0.
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:
hash
to\Nuwave\Lighthouse\Schema\AST\DocumentAST
ProvidesCacheableValidationRules
which extendsProvidesValidationRules
for backward compatibility. In the next release we might removeProvidesValidationRules
.Defer::executeDeferred
SubscriptionBroadcaster::broadcast
AsyncMutation::handle
Errors
might fail to serialize.webonyx/graphql-php
, so there is no easy way to extend them and store hashes inside objects.I also added different benchmarks.
HugeRequestBench
creates requests with a lot of simple fragments: 1, 10 and 100 forbenchmark1
,benchmark10
andbenchmark100
respectively. Enabling validation cache improves execution time:benchmark1
from 4.222ms to 2.886msbenchmark10
from 14.984ms to 4.429msbenchmark100
from 189.641ms to 19.783ms