Bad performance of GraphQL ASP.NET Core Server
I have looked at the performance of the GraphQL ASP.Net core server.
Unfortunately it is very bad.
I have a native operation that takes about 0.25 seconds for 1000 simultaneous calls.
I have also provided this operation in a GraphQL schema as a query. When used locally with the DocumentExecuter I need about 2 seconds for 1000 simultaneous queries. This could be better, but is still acceptable.
But if I provide this schema also via a GraphQL WebServer and use the GraphQLHttpClient to make these 1000 simultaneous queries, it takes about 40 seconds.
A first check showed me that by far the most time is used before the resolver is called and after the resolver is finished. Since it is still comparatively fast with the DocumentExecuter the problem must be somewhere inside the GraphQL web server.
The web server was created according to the help and has no other tasks.
Are there any optional parameters to increase the performance?
Have you tested at some point of time the performance on your side?
Which serializer are you using? System.Text.Json or Newtonsoft.Json? Are you using dotnet core 3+?
System.Text.Json
Yes asp dot net core
The numbers are with Debug-Build and started from VisualStudio. When I start it from CMD I got following values: Native: 0,12 seconds DocumentExecuter: 1,42 seconds GraphQL Client to Server: 3,57 seconds
Without Debugger the numbers are much better, but not that perfect as suggested. For example with GRPC I can do the same in 0,98 seconds
It would be perfect if you provide benchmark here https://github.com/graphql-dotnet/server/tree/develop/src/Benchmarks so we can discover your case.
We cannot give you recommendations because we do not know your project configuration.
Closed due to the lack of feedback.