DataLoader Pattern
Learn about common performance issues with GraphQL applications and how the DataLoader pattern can help fix them.
We'll cover the following
We’ve covered a lot of ground in this course. We have a working backend, a frontend that sends queries and mutations, and even a password-based authentication to protect our application. But this doesn’t mean that we’ve covered all there is to know about GraphQL!
In this chapter, we’ll look into some more advanced GraphQL topics. First, we’ll see how we can significantly improve the performance of our GraphQL API by using DataLoaders. Then, we’ll spend a few lessons learning how we can use caching on the frontend more efficiently. Later, we’ll see how to write tests for our React components that use GraphQL queries.
Performance issues
In this lesson, we’ll look into the performance of our GraphQL API. Our API doesn’t have a lot of business logic and mostly just queries data from a database, so let’s see what really happens with our queries.
To see what’s going on, we can use this small code snippet that logs every Mongo query we perform.
Get hands-on with 1200+ tech skills courses.