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

Add unaliased path to resolve info #1548

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Mar 24, 2024

Fixes #1345

src/Error/Error.php Outdated Show resolved Hide resolved
@ruudk
Copy link
Contributor Author

ruudk commented Mar 26, 2024

@spawnia This one is ready for review, when you have time.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 10, 2024

@spawnia You are probably busy. Do you have time for a review? Or is there anybody else that can do it?

src/Executor/ReferenceExecutor.php Outdated Show resolved Hide resolved
src/Executor/ReferenceExecutor.php Outdated Show resolved Hide resolved
@ruudk ruudk force-pushed the unaliased-path branch 5 times, most recently from 659dbec to 9bd93d3 Compare June 10, 2024 09:04
@ruudk ruudk requested a review from spawnia June 10, 2024 09:09
@ruudk
Copy link
Contributor Author

ruudk commented Jun 10, 2024

@spawnia this is ready now. The errors are not related to this PR.

docs/class-reference.md Outdated Show resolved Hide resolved
@spawnia
Copy link
Collaborator

spawnia commented Jun 10, 2024

Please merge master, I just fixed the PHPStan issues.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 10, 2024

It's green now.

@ruudk ruudk requested a review from spawnia June 10, 2024 09:38
@spawnia spawnia merged commit 9cd6441 into webonyx:master Jun 10, 2024
@ruudk ruudk deleted the unaliased-path branch June 10, 2024 09:43
Copy link
Collaborator

@simPod simPod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhere in this change is performance issue 🤔 . v15.12.0 causes my app queries

Error: Maximum execution time of 60 seconds exceeded

while 15.11.2 is fine

@spawnia
Copy link
Collaborator

spawnia commented Jun 11, 2024

Somewhere in this change is performance issue 🤔 . v15.12.0 causes my app queries

Error: Maximum execution time of 60 seconds exceeded

while 15.11.2 is fine

Do they succeed after a while or do they loop forever?

@simPod
Copy link
Collaborator

simPod commented Jun 11, 2024

Seems like loop forever. I've waited 5m and nothing got finished. While on 15.11 it's done in ~10s (larger query).

@simPod
Copy link
Collaborator

simPod commented Jun 11, 2024

Do you have a tip or should I start profilling?

@ruudk
Copy link
Contributor Author

ruudk commented Jun 11, 2024

Interesting. We run a very large GraphQL schema in production with a lot of traffic and did not notice anything different.

@simPod
Copy link
Collaborator

simPod commented Jun 11, 2024

My other app works fine. Also I cannot reproduce locally. I synced php patch versions and still the issue is only in prod env, not local one. I'm trying to investigate further.

@simPod
Copy link
Collaborator

simPod commented Jun 11, 2024

I have compared the two versions, you can see where the latest one is slower

https://blackfire.io/profiles/compare/07b25a5c-c984-49fb-a134-5b4026020104/graph

@ruudk
Copy link
Contributor Author

ruudk commented Jun 11, 2024

What kind of query did you use? Is this a big query that is using a big list or is it nested deep?

While looking at the diff in completeListValue I fail to see why this might be slower.

{
$containsPromise = false;
$results = [];
foreach ($fields as $responseName => $fieldNodes) {
$fieldNodes = $fields[$responseName];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simPod This might be the issue. This line does not make any sense, $fieldNodes is already defined in the foreach.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in #1570

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ruudk added a commit to ruudk/graphql-php that referenced this pull request Jun 11, 2024
Somehow this was added in webonyx#1548 but I fail to see why.

Let's remove it.

This might be the cause for the performance degradation reported in webonyx#1548.
spawnia pushed a commit that referenced this pull request Jun 11, 2024
Somehow this was added in #1548 but I fail to see why.

Let's remove it.

This might be the cause for the performance degradation reported in #1548.
simPod pushed a commit to simPod/graphql-php that referenced this pull request Jun 11, 2024
Somehow this was added in webonyx#1548 but I fail to see why.

Let's remove it.

This might be the cause for the performance degradation reported in webonyx#1548.

Add property `unaliasedPath` to `ResolveInfo`
simPod added a commit to simPod/graphql-php that referenced this pull request Jun 12, 2024
- make some lines a bit shorter

Still did not find a way to avoid performance slowdown introduced in webonyx#1548. This is just an outcome of few hours I looked at the code.
@simPod
Copy link
Collaborator

simPod commented Jun 13, 2024

Interesting. We run a very large GraphQL schema in production with a lot of traffic and did not notice anything different.

@ruudk the issue appears when you return a lot of entries. For each entry it computes the path and now unaliasedPath. That causes the slowdown. The query depth is not relevant. If you're returning small datasets you won't notice the slowdown.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 13, 2024

I think it would be great to have a unit test that reproduces the issue. Then we can work on making this faster. Could you create it ?

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

Successfully merging this pull request may close these issues.

Add real path to ResolveInfo
3 participants