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

GraphQL schema is transformed on every request, leading to performance issues #289

Open
256cats opened this issue Nov 9, 2020 · 0 comments

Comments

@256cats
Copy link

256cats commented Nov 9, 2020

Hi, GraphQLJpaExecutorContext transforms the schema field visibility rules on every request and it leads to performance drop.

Specifically, in https://github.com/introproventures/graphql-jpa-query/blob/master/graphql-jpa-query-schema/src/main/java/com/introproventures/graphql/jpa/query/schema/impl/GraphQLJpaExecutorContext.java#L108 :

   @Override
    public GraphQLSchema getGraphQLSchema() {
        GraphQLCodeRegistry codeRegistry = graphQLSchema.getCodeRegistry()
                                                        .transform(builder -> builder.fieldVisibility(graphqlFieldVisibility.get()));

        return graphQLSchema.transform(builder -> builder.codeRegistry(codeRegistry));
    }

Correct me, if I'm wrong, It seems that graphQLSchema and graphqlFieldVisibility are set once when GraphQLJpaExecutorContext is created, and the result of transformation is always the same, therefore this transformation can be applied only once when GraphQLJpaExecutorContext is created and not on every request. When we updated this code, we got a huge performance boost.

BTW, thanks for library, it's cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant