How can I make my graphene-python API respond faster?

1k Views Asked by At

I've built a python/daphne/django/graphene server, and did everything I could to optimize my queries -- cached db queries in Redis so that they are basically free, and eventually came to find that even with a very small graph schema I still see a >200ms overhead inside of graphql-core, evidently parsing my query.

I come from a REST-api-centric worldview, and in this case the stack decisions were out of my hands. I'm just trying to make it work. Queries that a normal django view should return in ~20ms still take ~250ms.

Given that I'm consistently sending the same few queries, it would be fantastic to skip the repetitive parsing of the same query over and over again.

So, I'm curious what the Python graphql people do, to make their service perform, and to begin with, I'd like to know:

  1. Should I just expect to live with that query overhead?
  2. Can I improve by doing something like switching from Daphne to Uvicorn, or even mod_wsgi (am not doing any async stuff)
  3. Is there any way to circumvent repeated parsing of the same query?

thanks for your time and assistance.

0

There are 0 best solutions below