Skip to content
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

Refactor the GraphQL Module to Improve the Performance #7652

Open
DimuthuMadushan opened this issue Feb 28, 2025 · 1 comment
Open

Refactor the GraphQL Module to Improve the Performance #7652

DimuthuMadushan opened this issue Feb 28, 2025 · 1 comment
Assignees
Labels
module/graphql Issues related to Ballerina GraphQL module Type/Task

Comments

@DimuthuMadushan
Copy link

DimuthuMadushan commented Feb 28, 2025

Description

We have conducted a load test on the GraphQL module, and it shows that even though the CPU usage is high, the throughput is low. After profiling, we identified the areas that take most of the time while processing requests. To improve performance, we are planning to try out the following changes in GraphQL module:

  1. Reduce the usage of cloneReadOnly() in the parser.
  2. Minimize lock usage.
  3. Use the readonly type wherever possible.
  4. Reduce the usage of Ballerina's is checks in the parser.
  5. Replace string:Char usages with string.
  6. Refactor the Node modifier context.
  7. Refactor Response formatter.

Version

update 9, 10, 11

@DimuthuMadushan DimuthuMadushan added module/graphql Issues related to Ballerina GraphQL module Type/Task labels Feb 28, 2025
@DimuthuMadushan DimuthuMadushan self-assigned this Feb 28, 2025
@DimuthuMadushan DimuthuMadushan changed the title Refactor GraphQL Module to Reduce Usages of cloneReadOnly(), clone() Functions Refactor the GraphQL Module to Improve the Performance Mar 7, 2025
@DimuthuMadushan
Copy link
Author

DimuthuMadushan commented Mar 7, 2025

I attempted tasks 1 and 6, but they did not show any improvement compared to the above changes. Currently, I am working on refactoring the response formatter.

@ThisaruGuruge has completed tasks 2, 3, 4, and 5, which have increased performance by 3X and significantly reduced latency. Refer to the performance comparison for more details.

Complex query:

Image

Simple query:

Image

PR: ballerina-platform/module-ballerina-graphql#2175

We have released GraphQL 1.13.2 with these changes.

Currently i'm working on task 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/graphql Issues related to Ballerina GraphQL module Type/Task
Projects
Status: In Progress
Development

No branches or pull requests

2 participants