Degradation of GraphQL and Rest API query performance since v4.0.0 #18107
Unanswered
TheLastochka
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Netbox Version
v4.1.6
Python Version
3.11
After switching to the Strawberry library, there has been a significant decline in the performance of API requests, including Graphql.
By executing a request to get custom fields or assigned objects, Graphql executes briefly more queries to the database.
Consider the following Graphql query:
The database contains about 27k ip addresses.
Netbox v3.7.8
This query produced 5k database queries (execution time: 14 seconds).
If you remove assigned_object's and custom_fields from this Graphql query, the execution time does not change.
Netbox v4.0.0 (Strawberry)
The same query produces 87k database queries (execution time: 7.6 minutes).
If you remove assigned_object's and custom_fields from this Graphql query, the execution time drops to the expected values (execution time is 8 seconds).
Previously, there was a similar problem on the netbox v3.4 version #11291
However, it was fixed in version v3.5 by writing optimizers.
After switching to Strawberry, the optimizers remained in the old code. And the problem is back.
Beta Was this translation helpful? Give feedback.
All reactions