Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Solve N+1 Problem in GraphQl API
Search
Ngalam Backend Community
April 28, 2019
Programming
2
50
Solve N+1 Problem in GraphQl API
Ngalam Backend Community
April 28, 2019
Tweet
Share
More Decks by Ngalam Backend Community
See All by Ngalam Backend Community
Web_Scraping_with_Scrapy.pdf
ngalambackend
0
81
Introduction to Flask
ngalambackend
0
180
Achieving API Performance and Scalability
ngalambackend
0
87
Interfaces in Go
ngalambackend
0
59
CSS in JS in action
ngalambackend
0
56
Productive Remote Working with Scrum
ngalambackend
0
96
Covid Tracker Kota Malang
ngalambackend
0
68
Supercharge Local Development with Docker
ngalambackend
1
130
Building Scalable and Flexible API by Leveraging GraphQL and BigTable
ngalambackend
1
320
Other Decks in Programming
See All in Programming
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
230
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
Oxlintはいいぞ
yug1224
5
1.3k
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
dchart: charts from deck markup
ajstarks
3
990
今から始めるClaude Code超入門
448jp
8
8.7k
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.1k
「ブロックテーマでは再現できない」は本当か?
inc2734
0
990
Oxlint JS plugins
kazupon
1
950
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
CSC307 Lecture 08
javiergs
PRO
0
670
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
68
Visualization
eitanlees
150
17k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
310
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
340
We Have a Design System, Now What?
morganepeng
54
8k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
The SEO identity crisis: Don't let AI make you average
varn
0
240
Being A Developer After 40
akosma
91
590k
Transcript
Solve N+1 Problem in GraphQL API Disyam Adityana Putra Team
Leader @ Hash Rekayasa Teknologi
Ask The Audience • Raise Your Hand • Know GraphQL
• Try GraphQL • Use GraphQL
N+1 Problem
dataloader to the rescue
dataloader • batching • caching • per request • fetch
data modification
dataloader const DataLoader = require('dataloader') const userLoader = new DataLoader(keys
=> myBatchGetUsers(keys));
dataloader input = [2, 1, 5, 3, 4]; output =
[ { id: 2, name: "two" }, { id: 1, name: "one" }, { id: 5, name: "five" } { id: 3, name: "three" } { id: 4, name: "four" } ];
batching • The Array of values must be the same
length as the Array of keys • Each index in the Array of values must correspond to the same index in the Array of keys
caching const userLoader = new DataLoader(...) const result1 = await
userLoader.load(1) const result2 = await userLoader.load(1) assert(result1 === result2)
Other implementations PHP: DataLoaderPHP Ruby: Dataloader, BatchLoader ReasonML: bs-dataloader Java:
java-dataloader Elixir: dataloader Golang: Dataloader
Question?
Thank You code: https://github.com/disyam/graphql-loader