Replace ServerSide Joins with Dataloader Batches
fenos opened this issue · comments
Going forward
After leveraging server side joins in a real production scenario it seem not a good option to resolve GraphQL queries.
The complexity and the computation needed to leverage dynamic joins is not worth.
GraphQL-thinky will now go in another direction, still leveraging batching and performant queries but this time with Dataloader in place.
- No Server side joins between resolved fields
- Yes, batching ids and queries computation, with intelligent comparison of similar queries to reduce round trips to the Database.
- Customisable query batching
- Will be one of the first library to orchestrate internally Dataloader to perform efficient queries
Progress
- The first working version is now under testing, the results are pretty good and efficent
- Beta release out npm
0.4.0-beta-1
working branch dataloader-branch - Full version, Shipping in a week or two
Breaking changes
- I tried to keep breaking change at the minimum, here the list:
- Replaced limit argument with offset
- Working Progress...
Beta release out npm 0.4.0-beta-1
working branch dataloader-branch
TODO
- Order By argument
- Backwards Pagination
last
- More unit tests around the
ModelLoader
class - Update Documentation
- Introduced FlowTypes, increase flow coverage
- Tidy Up Code and comments
0.4.0-beta-3
almost out, The following changes are done:
- Refactored whole code base, removing redundant code of previous versions
- Dataloader now can
prime
result safely if is not requested to select specific fields - Added useful error messages, through the code base
- Improve whole stability of the library, Performance are pretty good
- Refined Relay Connection
Stay tuned for the release
0.4.0-beta-3
Released!
Current Stage
The query resolution of the library has been successfully migrated to use Dataloader
batch and cache instead of joins across the schema. General bug fixes and smaller overall codebase, Server side Relay ready, and Integration tests are all passing.
What's next?
The library is preparing for the official version 0.4
. There wouldn't be any further optimizations on the query resolution
side until the v0.4
is out. The todo list above has to be completed before move forward.
Notes
As I accepted the challenge to optimize graphql-thinky for a production environment, the entry of Dataloader
in the project was needed BUT experimental. With few schemas on my whiteboard I could see that it could work if I only could try. The overall effort that i spent on it is absolutely
gratifying.
To the Community
As the project is moving forward, the community help is very precious in terms of features and improvements. If you have any doubt, question, feedback or consideration, please feel very welcome to open an issue! 👍