-
Notifications
You must be signed in to change notification settings - Fork 466
feat: only eagerlyLoadType on introspection requests
#3172
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
feat: only eagerlyLoadType on introspection requests
#3172
Conversation
- introduce WPGraphQL::set_is_introspection_query and WPGraphQL::is_introspection_query - Prevent eagerly loading types if the request is not an introspection request - adjust tests to get the schema using WPGraphQL::get_schema instead of $request->schema - adjust PostObjectMutationTest which was failing because of invalid mutation, not because the error preventing the post from being deleted - update RequestTest to expect an exception
|
Tests passing against this branch for:
Of them, Rank Math is strangely experiencing a significant slowdown on interface queries, but that could also be something with my local machine. I'll try to run some k6/xhprof benchmarks over the weekend and see if I can spot a real discrepancy between this branch and |
|
@justlevine sounds good! Ya as much as I want to get this out ASAP I want to get it "right" more than get it out fast |
|
@jasonbahl not sure if its because I'm stuck trying to run these tests on LocalWP + Windows, but while i'm seeing marginal->modest improvements on object queries, queries that rely on interfaces seem to be slower. Would recommend you do some performance comparisons locally as well. DMing you the test conditions + data I used. |
|
Code Climate has analyzed commit 5095d41 and detected 0 issues on this pull request. View more on Code Climate. |
eagerlyLoadType on introspection requestseagerlyLoadType on introspection requests
What does this implement/fix? Explain your changes.
Any type that is registered to
eagerlyLoadTypewill now only be eagerly loaded for Introspection requests (typically used for tooling such as GraphiQL IDE, Codegen, etc)For standard execution of queries the eagerly loaded types will not be eagerly loaded which dramatically reduces the number of Object Types that are required to be generated per request.
This introduces:
Does this close any currently open issues?
Closes #3159
Any other comments?
This might be a breaking change if shipped as-is, as the Schema is now generated later in the lifecycle.
Performance Tests
I ran some (super basic) performance tests using k6.
(performance-test.js)
The test simulates 10 concurrent users executing the following query as a POST request and continues to execute as many times as it can for 10 seconds.
BEFORE
AFTER