graphql-python / graphql-python/graphql-core

Slow introspection query execution for large schemas

未關閉
#101 6 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
help wanted investigate optimization
主要語言
Python
星號
531
分支
146
PR 合併指標
30 天內沒有已合併 PR

描述

The graphql-core `graphql_sync` function takes approximately 20x slower than a module that I wrote that solely executes the introspection query. https://github.com/kensho-technologies/graphql-compiler/blob/main/graphql_compiler/fast_introspection.py

With the graphql-core Python library, executing the default introspection query (outputted from `get_introspection_query`) on a schema of around ten thousand types with `graphql_sync` takes 26 seconds to run. Writing my own module that calls the same graphql-core Type resolvers executes the same query on the same schema in 1.37 seconds.

I'm not sure what exactly is the time sink with the graphql-core's approach, but it might have to do with the generality of `graphql_sync` and thus, computing the next field to resolve at every step, and also `graphql_sync`'s recursive nature. Interestingly, I ran the same query on the same schema using Graphql.js, and the execution took less than 2 seconds (around 1.7 seconds).

Thank you for your time and all the work to port GraphQL.js to Python!

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

Start with graphql_sync and get_introspection_query, then compare their execution path with the referenced graphql_compiler/fast_introspection.py module. Reproduce the introspection query on a schema of around ten thousand types and profile the execution. Done means identifying and addressing the dominant overhead with a measured improvement over the reported 26-second runtime.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
api, performance
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。