server icon indicating copy to clipboard operation
server copied to clipboard

Bad performance of GraphQL ASP.NET Core Server

Open lichti81 opened this issue 6 years ago • 6 comments

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?

lichti81 avatar Jul 21 '20 13:07 lichti81

Which serializer are you using? System.Text.Json or Newtonsoft.Json? Are you using dotnet core 3+?

BenjaBobs avatar Jul 21 '20 13:07 BenjaBobs

System.Text.Json Yes asp dot net core

lichti81 avatar Jul 21 '20 15:07 lichti81

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

lichti81 avatar Jul 21 '20 15:07 lichti81

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.

sungam3r avatar Jul 21 '20 17:07 sungam3r

We cannot give you recommendations because we do not know your project configuration.

sungam3r avatar Jul 21 '20 17:07 sungam3r

Closed due to the lack of feedback.

sungam3r avatar Aug 17 '20 23:08 sungam3r