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

Async Batched Queries #1918

Open
tlaverdure opened this issue Aug 17, 2021 · 5 comments
Open

Async Batched Queries #1918

tlaverdure opened this issue Aug 17, 2021 · 5 comments
Assignees
Labels
enhancement A feature or improvement performance Fix or optimization of performance

Comments

@tlaverdure
Copy link
Collaborator

What problem does this feature proposal attempt to solve?

It looks like webonyx/graphql-php can fetch data asynchronously. https://webonyx.github.io/graphql-php/data-fetching/#async-php

I'm not sure if batched queries are currently executed synchronously or asynchronously, but I could imagine there would be great performance benefits if they were resolved asynchronously. @spawnia could you confirm? It looks like you have been working on the ReactPromiseAdapter recently and I'm not sure if that is related. 👀

https://github.com/webonyx/graphql-php/commits/master/src/Executor/Promise/Adapter/ReactPromiseAdapter.php

Which possible solutions should be considered?

I assume we could allow an alternate path for execution here if we wanted to use promiseToExecute():

lighthouse/src/GraphQL.php

Lines 159 to 165 in 985d39e

$result = $this->executeQuery(
$query,
$context,
$params->variables,
null,
$params->operation
);

And I'm also naively assuming that it should just work but let me know what you think.

@spawnia
Copy link
Collaborator

spawnia commented Aug 17, 2021

I am all over the graphql-php codebase, mostly working on strict typing and uncovering/fixing bugs. Have not paid particular attention to async execution.

Your assumption seems sound, I think it is very much possible and useful for Lighthouse to allow alternative executors. Open for pull requests 😉

@spawnia spawnia added enhancement A feature or improvement performance Fix or optimization of performance labels Aug 17, 2021
@tlaverdure
Copy link
Collaborator Author

Cool, I'll dig in once I find some time. Thanks for the feedback.

@tlaverdure tlaverdure self-assigned this Aug 17, 2021
@bingalls
Copy link

bingalls commented Sep 5, 2021

async php & react php are converging; you might want to implement this in php v8.1 fibers

@mathiasmoser
Copy link

i think async execution would be a great improvement for lighthouse. perhaps laravel octane could help to reach that behaviour

@JeroenJochems
Copy link

@mathiasmoser how would laravel octane help with this?

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

No branches or pull requests

5 participants