freeCodeCamp / open-api

freeCodeCamp's open-api Intiative
BSD 3-Clause "New" or "Revised" License
88 stars 28 forks source link

Use dataloader #38

Open ojongerius opened 6 years ago

ojongerius commented 6 years ago

Dataloader is a project from Facebook and allows removing pressure from the database: https://github.com/facebook/dataloader .

As per the README, it does not replace shared application level caches. It's meant to be used per request, and prevent multiple DB calls when one will do. See https://github.com/facebook/dataloader/blob/master/README.md.

Premature optimisation for now, but will come in handy when we are in need for performance improvements.

See https://github.com/withspectrum/spectrum/tree/alpha/api/loaders for a JS implementation.

ojongerius commented 6 years ago

Closing for now.

ojongerius commented 6 years ago

Reopening this, it's not too complicated to get in and will really help offload the database.

ojongerius commented 6 years ago

Note to self: article with examples of dataloader and Mongo at http://www.petecorey.com/blog/2017/08/14/batching-graphql-queries-with-dataloader/

ojongerius commented 6 years ago

Like #89 this makes sense when we have have types that refer to each other.

Bouncey commented 6 years ago

Busy getting my learn on, but wanted to save a link to this video by MPJ on dataloader