-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Describe the bug
Apollo Server with GraphQL Modules v1 appears to be twice as slow as it was with v0.
To Reproduce
I've created a simple repo with three basic servers to demonstrate the performance differences. A load testing script performs as many requests as possible within 10 seconds.
| Server | Median Request Duration | Request Count |
|---|---|---|
| Apollo Standalone | 236ms | 42 |
| Apollo + GQL Modules v0 | 229ms | 43 |
| Apollo + GQL Modules v1 | 460ms | 22 |
Each server uses the same schema, resolver, and JSON dataset. See the repo for more details and instructions. The test uses a larger dataset (3MB), but we observed a similar 100% latency increase even with smaller payloads.
Expected behavior
Using Apollo Server with GraphQL Modules v1 is similar or better performance to v0.
Environment:
- OS: macOS
- graphql-modules:
1.4.2 - NodeJS:
16.3.0
Additional context
Using createApolloExecutor (as implemented here) instead of createSchemaForApollo seems to address the performance problem. However, using the custom executor broke field usage and resolver tracing in Apollo Studio.
I noticed your benchmarks for Apollo Server are all using createApolloExecutor, so it isn't capturing the slowdown that seems to happen when using createSchemaForApollo.
The docs recommend createSchemaForApollo for Apollo Server, but the API Reference calls both createSchemaForApollo and createApolloExecutor experimental.
Is there a recommended way of using v1 with Apollo Server that is performant and works with Apollo Studio? Thanks!