I encountered a performance issue when returning a large array of nested objects as response to a GraphQL query and was wondering whether it would be considered an actual performance issue or out of scope. This is a minimal GraphQL API to reproduce the issue, using a generated project with smallrye-graphql and lombok from code.quarkus.io:
@GraphQLApi
public class TestGraphQLAPI {
private static final List<SomeWrapper> objects = IntStream
.range(0, 10_000_000)
.mapToObj(i -> new SomeWrapper("value #" + i))
.collect(Collectors.toList());
@Value
public static class SomeWrapper {
String someValue;
}
@Query
public List<SomeWrapper> giveMeLargeResponse() {
return objects;
}
}
I am querying the endpoint using curl:
curl 'http://localhost:8080/graphql' --data-raw '{"query":"{giveMeLargeResponse {someValue}}","variables":null}' > /dev/null
If I pipe the response to a file, the file is roughly 300MB in size.
The request takes roughly 72s to return on an Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz (1 core fully utilized) and intermittedly takes up around 8.2GB of RAM.
I know 10 million entries is a lot, but I expected the query to return much faster, given that it only needs to serialize and output the data. The majority of the time seems to be spent within completeValueForList:

I attached the VisualVM snapshot data: graphql-performance-10mio.zip
I encountered a performance issue when returning a large array of nested objects as response to a GraphQL query and was wondering whether it would be considered an actual performance issue or out of scope. This is a minimal GraphQL API to reproduce the issue, using a generated project with smallrye-graphql and lombok from
code.quarkus.io:I am querying the endpoint using curl:
If I pipe the response to a file, the file is roughly 300MB in size.
The request takes roughly 72s to return on an
Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz(1 core fully utilized) and intermittedly takes up around 8.2GB of RAM.I know 10 million entries is a lot, but I expected the query to return much faster, given that it only needs to serialize and output the data. The majority of the time seems to be spent within

completeValueForList:I attached the VisualVM snapshot data: graphql-performance-10mio.zip