Skip to content

Performance issues with large data sets and pagination. #829

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

Open
jedie opened this issue Dec 19, 2019 · 3 comments
Open

Performance issues with large data sets and pagination. #829

jedie opened this issue Dec 19, 2019 · 3 comments

Comments

@jedie
Copy link
Contributor

jedie commented Dec 19, 2019

It is known that GraphQL is not the fastest API when you have many objects, see: graphql-python/graphene#268

If you have many objects, you want to use pagination with DjangoConnectionField.

I have run some benchmarks for this:

  1. There are 1000 items and i fetch 100 of them:
django v1.11.26
graphene v2.1.8
graphene-django v2.7.1
Use timeit statement: graphene.Schema(query=Query).execute('{Items(first: 100) {edges {node {id}}}}')
Run one timeit call... takes: 13.3 ms
timeit... use 5 * 75 loop...
max...: 10.84 ms
median: 10.66 ms
min...: 10.61 ms
cProfile stats for one request: 30148 function calls (28688 primitive calls) in 0.019 seconds
  1. There are only 100 items and i didn't use a DjangoConnectionField:
django v1.11.26
graphene v2.1.8
graphene-django v2.7.1
Use timeit statement: graphene.Schema(query=Query).execute('{Items {id}}')
Run one timeit call... takes: 13.3 ms
timeit... use 5 * 106 loop...
max...: 7.54 ms
median: 7.48 ms
min...: 7.29 ms
cProfile stats for one request: 18556 function calls (17830 primitive calls) in 0.012 seconds

Graphene already makes a lot of calls anyway. But with these two variants there is also a very clear difference to be noticed.

@stale
Copy link

stale bot commented Apr 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 17, 2020
@stale stale bot closed this as completed May 17, 2020
@ulgens ulgens reopened this May 17, 2020
@pcraciunoiu
Copy link
Contributor

See #965, looks like the same issue I had. And #986 with follow-up fixes.

@stale
Copy link

stale bot commented Aug 27, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Aug 27, 2020
@ulgens ulgens removed the wontfix label Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants