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
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
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.2k
How STYLIGHT went responsive
nonsquared
100
6.2k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
460
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
260
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
250
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
200
The Curious Case for Waylosing
cassininazir
1
400
Music & Morning Musume
bryan
47
7.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
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ͬͨ΄͏͕ૣͦ͏