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
fastifyはいいぞ
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ykmikan
February 27, 2018
2.1k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
fastifyはいいぞ
ykmikan
February 27, 2018
Featured
See All Featured
A better future with KSS
kneath
240
18k
4 Signs Your Business is Dying
shpigford
187
22k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
How GitHub (no longer) Works
holman
316
150k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
590
The Limits of Empathy - UXLibs8
cassininazir
1
360
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
WCS-LA-2024
lcolladotor
0
650
Six Lessons from altMBA
skipperchong
29
4.3k
Color Theory Basics | Prateek | Gurzu
gurzu
0
370
Odyssey Design
rkendrick25
PRO
2
700
Transcript
Fastify ͍͍ͧ
ࣗݾհ ❖ ykmikan ❖ airClosetॴଐ ❖ angularͱ͔nodeΛͬͯࣾγεςϜ࡞ͬͯ·͢
Fastifyͬͯ·͔͢ʁ
fastify ❖ pinoͷ࡞ऀ͕࡞ͬͨ web framework ❖ Φʔόʔϔου͕খ͍͞ ❖ inspired by
hapi, express ❖ expressRestifyޓͷϛυ ϧΣΞΛαϙʔτ ❖ validationͱserialize͕͋Δ ❖ ࠷ۙ v1.0ͷrc൛͕ग़ͨ
fastify
ɹॻ͖ํ expressͬΆ͍ router ॲཧ෦
validation & serialization ❖ ajv The fastest JSON Schema
validator for Node.js and browser. Supports draft-04/06/07. jsͰ͔͚Δ!! swaggerΑΓॻ͖͍͢!!
for swagger ui ❖ fastify-swagger ❖ doc generator ❖ swagger-tools
❖ swagger ui ग़ͭ͢
None
ॻ͖͍͢ʂʂ طଘͷϓϥάΠϯͱ͔͑Δ͠!! ྑ͛͞!!
ଌͬͯΈΑ͏ʂʂ
Express vs Koa vs Fastify ❖ ࡞ͨ͠API ❖ apiͷpath /api/sample/hello
❖ Query string ❖ userName, greeting ❖ Response ❖ Message: `${userName}, ${greeting}`
Express vs Koa vs Fastify ❖ ࣮ߦڥ ❖ node: v8.3.0
❖ mac book pro i7, 16GB ❖ ࣮ߦίϚϯυ autocannon -c 100 -d 40 -p 10 “http://localhost:3011/api/sample/hello?userName=test&greeting=hello" Framework Version Router Version Express v4.16.2 Default - Koa v2.5.0 Koa-router v7.4.0 Fastify v1.0.0-rc2 Default (find-my-way) v1.10.1
ଌఆ݁Ռ express koa fastify Latency 8.38 ms 8.26 ms 5.18
ms Req/Sec 11758.25 11978.85 18954.41 Bytes/Sec 2.8 MB 2.8 MB 2.96 MB ❖ autocannon -c 100 -d 40 -p 10 “http://localhost:3011/api/sample/hello? userName=test&greeting=hello"
Ͳ͏ͬͯૣͨ͘͠Μʁ
fast-json-stringify ❖ validationserializeͰ༻͍ͯ͠ΔajvͰ༻ ❖ طଘͷͷͱൺͯ2 ~ 4ഒૣ͍ ❖ ಛʹϖΠϩʔυ͕খ͚͞Εখ͍͞΄Ͳ͕ࠩେ͖͍
find-my-way ❖ طଘͷϧʔςΟϯάͱൺͯ10ഒૣ͍ ❖ radix tree(ύτϦγΞ)ΛͬͯߴԽ
·ͱΊ ❖ طଘͷwebϑϨʔϜϫʔΫͱൺͯૣ͍ ❖ validationserialize͕jsͰॻ͚͍͍ͯ ❖ json-stringify͏ͳΒɺfast-json-stringifyͬͨ΄͏͕ૣͦ͏