-
Notifications
You must be signed in to change notification settings - Fork 183
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
Really slow for huge list of objects #319
Comments
Performance discussion for GraphQL Core Next: graphql-python/graphql-core#54 I'm afraid there isn't much we can do in Ariadne to speed things up for cases such as these. Query executor does plenty of function calls to resolve values. There's functions all the way down, with at least 3 for each value returned for field: resolver call, Low hanging fruit for Ariadne that comes to mind would be adding cache to query parser (parsing complex queries can make up to 20% of query execution time), but that's really only buying time before somebody else returns even more data from their query. |
I just did some profiling and, indeed, the slowest part is everything that is happening inside |
I think than I'm trying to rewrite it with cython but it's a huge work. |
Out of curiosity, have you considered using PyPy? (Disclaimer: it only supports Python 3.6 for now, 3.7 support is underway.) |
I can't (I need last version of hypercorn wich need python >= 3.7) Have you tried with pypy ? What about the performances ? |
I don't have any precise data about Ariadne to share but I've heard people mention that in their tests PyPy made pure-Python ASGI servers as fast as uvicorn or hypercorn. |
Looks like graphql-core 3.1 is promising performance improvements in query executor, but we'll have to update our codebase to support it. |
@rafalp Looks like this could improve with the |
@levrik correct. We've updated GraphQL-Core to 3.1 in 0.13 and will ship it in few weeks, once the rest of features pull requests have been merged. |
For the record, here's the PR: #393 |
@rafalp any updates on getting the 0.13 release of Ariadne published with the upgrading of graphql-core to 3.1 change? |
I want to release 0.13 soon with GraphQL core bumped to 3.1.3. |
Ariadne 0.13 has been released. Closing this. |
We have a structure like this. The
foo
property onFoo
can contain thousands of items. Sadly we need all of them at once, so we can't paginate over it.There's only one resolver to resolve
foo
itself which is quite fast (getting the nested object from a Mongo DB).Our current workaround is to implement a custom
JSON
scalar which just returns the data, by-passing all child resolvers. But this way we're loosing everything that GraphQL gives us.Is there anything that can be used to speed this up without using a
JSON
scalar or is this the best solution already? I know that GraphQL comes with some overhead but this can go up to 20 seconds vs 1 second withJSON
scalar.We're using Ariadne in sync-mode.
The text was updated successfully, but these errors were encountered: