Suche senden
Hochladen
Understand How Node.js and Core Features Works
•
1 gefällt mir
•
481 views
Hengki Sihombing
Folgen
Understand How Node.js and Core Features Works and You dont know Node.JS
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 84
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Node.Js: Basics Concepts and Introduction
Node.Js: Basics Concepts and Introduction
Kanika Gera
Nodejs
Nodejs
Prem Sanil
Webconf nodejs-production-architecture
Webconf nodejs-production-architecture
Ben Lin
Introduction to Node.js
Introduction to Node.js
Rob O'Doherty
Introduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
Node.js for beginner
Node.js for beginner
Sarunyhot Suwannachoti
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
Nurul Ferdous
Node.js Crash Course
Node.js Crash Course
David Neal
Empfohlen
Node.Js: Basics Concepts and Introduction
Node.Js: Basics Concepts and Introduction
Kanika Gera
Nodejs
Nodejs
Prem Sanil
Webconf nodejs-production-architecture
Webconf nodejs-production-architecture
Ben Lin
Introduction to Node.js
Introduction to Node.js
Rob O'Doherty
Introduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
Node.js for beginner
Node.js for beginner
Sarunyhot Suwannachoti
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
Nurul Ferdous
Node.js Crash Course
Node.js Crash Course
David Neal
Node.js tutoria for beginner
Node.js tutoria for beginner
Maninder Singh
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Naveen S.R
Node js introduction
Node js introduction
Joseph de Castelnau
Introduction to node.js
Introduction to node.js
Arun Kumar Arjunan
Complete MVC on NodeJS
Complete MVC on NodeJS
Hüseyin BABAL
Nodejs - Building a RESTful API
Nodejs - Building a RESTful API
Sang Cù
Introduction to Node.js
Introduction to Node.js
AMD Developer Central
Node.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend Development
Julián David Duque
Introduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
Bhagaban Behera
Node js for beginners
Node js for beginners
Arjun Sreekumar
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
Introduction to Node.js
Introduction to Node.js
Vikash Singh
Introduction to node.js
Introduction to node.js
Dinesh U
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
Jeff Harrell
Create Rest API in Nodejs
Create Rest API in Nodejs
Irfan Maulana
Node js Introduction
Node js Introduction
sanskriti agarwal
Nodejs presentation
Nodejs presentation
Arvind Devaraj
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
Hello world - intro to node js
Hello world - intro to node js
Refresh Annapolis Valley
Weitere ähnliche Inhalte
Was ist angesagt?
Node.js tutoria for beginner
Node.js tutoria for beginner
Maninder Singh
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Naveen S.R
Node js introduction
Node js introduction
Joseph de Castelnau
Introduction to node.js
Introduction to node.js
Arun Kumar Arjunan
Complete MVC on NodeJS
Complete MVC on NodeJS
Hüseyin BABAL
Nodejs - Building a RESTful API
Nodejs - Building a RESTful API
Sang Cù
Introduction to Node.js
Introduction to Node.js
AMD Developer Central
Node.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend Development
Julián David Duque
Introduction to node.js GDD
Introduction to node.js GDD
Sudar Muthu
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
Bhagaban Behera
Node js for beginners
Node js for beginners
Arjun Sreekumar
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
Introduction to Node.js
Introduction to Node.js
Vikash Singh
Introduction to node.js
Introduction to node.js
Dinesh U
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
Jeff Harrell
Create Rest API in Nodejs
Create Rest API in Nodejs
Irfan Maulana
Node js Introduction
Node js Introduction
sanskriti agarwal
Nodejs presentation
Nodejs presentation
Arvind Devaraj
Was ist angesagt?
(20)
Node.js tutoria for beginner
Node.js tutoria for beginner
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
Node js introduction
Node js introduction
Introduction to node.js
Introduction to node.js
Complete MVC on NodeJS
Complete MVC on NodeJS
Nodejs - Building a RESTful API
Nodejs - Building a RESTful API
Introduction to Node.js
Introduction to Node.js
Node.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend Development
Introduction to node.js GDD
Introduction to node.js GDD
GeekCampSG - Nodejs , Websockets and Realtime Web
GeekCampSG - Nodejs , Websockets and Realtime Web
Node js for beginners
Node js for beginners
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Introduction to Node.js
Introduction to Node.js
Introduction to node.js
Introduction to node.js
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
Create Rest API in Nodejs
Create Rest API in Nodejs
Node js Introduction
Node js Introduction
Nodejs presentation
Nodejs presentation
Ähnlich wie Understand How Node.js and Core Features Works
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
Hello world - intro to node js
Hello world - intro to node js
Refresh Annapolis Valley
Beginners Node.js
Beginners Node.js
Khaled Mosharraf
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
Eugene Lazutkin
A brief intro to nodejs
A brief intro to nodejs
Jay Liu
Introduction to Node JS.pdf
Introduction to Node JS.pdf
Bareen Shaikh
Deep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdf
ShubhamChaurasia88
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
datafundamentals
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
Software Guru
SGCE 2015 REST APIs
SGCE 2015 REST APIs
Domingo Suarez Torres
JHipster
JHipster
Yuen-Kuei Hsueh
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.
Junichi Ishida
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJS
Andhy Koesnandar
Fission Introduction
Fission Introduction
Ta Ching Chen
Построение простого REST сервера на Node.js | Odessa Frontend Code challenge
Построение простого REST сервера на Node.js | Odessa Frontend Code challenge
OdessaFrontend
T4T Training day - NodeJS
T4T Training day - NodeJS
Tim Sommer
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
Ganesh Kondal
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
Valeri Karpov
Developing and Testing a MongoDB and Node.js REST API
Developing and Testing a MongoDB and Node.js REST API
All Things Open
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
Ethan Ram
Ähnlich wie Understand How Node.js and Core Features Works
(20)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Hello world - intro to node js
Hello world - intro to node js
Beginners Node.js
Beginners Node.js
SSJS, NoSQL, GAE and AppengineJS
SSJS, NoSQL, GAE and AppengineJS
A brief intro to nodejs
A brief intro to nodejs
Introduction to Node JS.pdf
Introduction to Node JS.pdf
Deep Dive into Node.js Event Loop.pdf
Deep Dive into Node.js Event Loop.pdf
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
Hadoop Demystified + Automation Smackdown! Austin JUG June 24 2014
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
SGCE 2015 REST APIs
SGCE 2015 REST APIs
JHipster
JHipster
Great Tools Heavily Used In Japan, You Don't Know.
Great Tools Heavily Used In Japan, You Don't Know.
Scalable server component using NodeJS & ExpressJS
Scalable server component using NodeJS & ExpressJS
Fission Introduction
Fission Introduction
Построение простого REST сервера на Node.js | Odessa Frontend Code challenge
Построение простого REST сервера на Node.js | Odessa Frontend Code challenge
T4T Training day - NodeJS
T4T Training day - NodeJS
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
Developing and Testing a MongoDB and Node.js REST API
Developing and Testing a MongoDB and Node.js REST API
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kiss.ts - The Keep It Simple Software Stack for 2017++
Kürzlich hochgeladen
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Mark Simos
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
charlottematthew16
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
comworks
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Zilliz
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
SeasiaInfotech2
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
hariprasad279825
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
charlottematthew16
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
gvaughan
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
Zilliz
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
Miki Katsuragi
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Scott Keck-Warren
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Florian Wilhelm
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Lorenzo Miniero
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Wonjun Hwang
Kürzlich hochgeladen
(20)
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Understand How Node.js and Core Features Works
1.
You Don’t know Node.js® Quick Intro to Core Features
2.
Hengki Sihombing Co-Founder & CTO at Urbanhire
3.
Agenda • Why use Node.JS • How it’s work •
Quick Intro Core Features Node • Node.js at Urbanhire • Q & A
4.
Slides & Code Everything: hBps://github.com/aredo/Ha-pdc-2017 or Just pdf Slides
5.
What the Hell Node.js is • JavaScript runHme built on Chrome's V8 JavaScript engine. • an event-driven •
Asynchronous (libuv) • Single Threaded but highly Scalable • Non Buffering
6.
StarHng with basics: Why Use Node.js®
7.
Why Node.js • Speed Development • EffecHve single codebase •
It is a good fit for real-Hme applicaHons • Node.js app will take up less system RAM • Because is Asynchronous
8.
Input/output is one of the most expensive type tasks (>CPU)
9.
The cost of I/O ? • Accessing RAM
~ 250 CPU cycle • Disk OperaHons ~ 41 000 000 CPU cycle - Read a file - Write a File • Network I/O ~ 240 000 000 CPU cycles - Database Query responses - HBp responses - Memcache results hBps://goo.gl/aU4TfP
10.
Node has non-blocking I/O
11.
PHP Sleep Node.js Sleep
12.
So…, How Node.js works?
13.
Blocking Web Server
14.
15.
Non-Blocking Web Server
16.
17.
Most web applicanHon are I/O Bound not CPU Bound
18.
hBps://www.slideshare.net/marcusf/nonblocking-io-event-loops-and-nodejs
19.
hBps://help.dreamhost.com/hc/en-us/arHcles/215945987-Web-server-performance-comparison
20.
Blocking systems have to be mulH-threaded
21.
Thread per connecHon is Expensive
22.
[MulH-threading] is the soWware equivalent of a nuclear device because if it is used incorrectly, it can blow up in your face. hBps://blog.codinghorror.com/threading-concurrency-and-the-most-powerful-psychokineHc-explosive-in-the-univ
23.
Node is single threaded… and that's good!
24.
Event Loop
25.
JavaScript has a concurrency model based on an "event loop". This model is quite different from models in other languages like C and Java.
26.
How exactly Event Loop works?
27.
28.
Bert Belder Libuv & Node.js Core developer hBps://www.youtube.com/watch?v=PNa9OMajw9w
29.
h_ps://goo.gl/aiT9Ga
30.
hBps://www.youtube.com/watch?v=PNa9OMajw9w
31.
hBps://www.youtube.com/watch?v=PNa9OMajw9w
32.
hBps://www.youtube.com/watch?v=PNa9OMajw9w
33.
hBps://www.youtube.com/watch?v=PNa9OMajw9w
34.
hBps://www.youtube.com/watch?v=PNa9OMajw9w
35.
Entering Node.js • Single thread for your code • … but I/O run in parallel •
Handle thousand of concurrent with single connecHon • Need to be careful with CPU-intensive code
36.
But.., It's sHll possible to write blocking code in Node.js
37.
Blocking Node.js Code
38.
Blocking Node.js Code
39.
Non-Blocking Node.js Code
40.
Most of Node.js is JavaScript
41.
Node.js !== Browser JavaScript
42.
global || GLOBAL How to create global variables (no window in Node.js) ???
43.
global has properHes
44.
global.__filename global.__dirname global.module global.require()
45.
global.process or process
46.
with process, you can do…!! • Access CLI input? • Get system info: OS, plaoorm, memory usage, versions, etc.? •
Read env vars (passwords!)?
47.
process.env process.argv process.pid process.cwd() process.exit() process.kill() hBps://nodejs.org/api/process.html
48.
Who likes and understands callbacks?
49.
callbackhell.com
50.
51.
Handling Callback Hell • Async.js • Promises (NaHve, Bluebird, Q) •
Generatos / co module • async/wait (Node v7 and v8)
52.
How to handle async errors?
53.
Handling Async Errors • Event Loop: Async errors are harder to handle/debug, because system loses context of the error. Then, applicaHon crashes. • Try/catch is not good enough, but for sync errors try/ catch works fine
54.
Best PracHces for Async Errors? • Listen to all “on error” events • Listen to uncaughtExcepHon •
Use domain (sos deprecated) or AsyncWrap • Log, log, log & Trace • NoHfy (opHonal) • Exit & Restart the process
55.
on(‘error’) Anything that inherits from or creates an instance of the above: Express, LoopBack, Sails, Hapi, etc.
56.
uncaughtExcepHon uncaughtExcepHon is a very crude mechanism for excepHon handling. An unhandled excepHon means your applicaHon - and by extension Node.js itself - is in an undefined state. Blindly resuming means anything could happen.
57.
How to deal with uncaughtExcepHon • You applicaHon shouldn’t have uncaughtexcepHons. This is clearly insane. • You should let your applicaHon crash, find uncaught excepHons and fix them. This is clearly insane. •
You should swallow errors silently. This is what lots of people do and it is bad. • You should let your applicaHon crash, log errors and restart your process with something like pm2, forever, upstart or monit. This is pragmaHc. • TesHng… TesHng.. TesHng...
58.
uncaughtExcepHon Examples
59.
Events Events are part of core and supported by most of the core modules while more advanced paBerns such as promises, generators, async/await are not.
60.
Events == Node Observer Pa_ern • Subject • Observers (event listeners) on a subject •
Event triggers
61.
Events in Node.js
62.
Events in Node.js
63.
Listeners
64.
Problems with Large Data • Speed: Too slow because has to load all • Buffer limit: ~1Gb •
Overhyped
65.
• Every acHon on a computer is an event. Like when a connecHon is made or a file is opened • In node.js an event can be described simply as a string with a corresponding callback.
66.
Stream AbstracHons for conHnuous chunking of data a stream is a sequence of data elements made available over Hme. hBps://en.wikipedia.org/wiki/Stream_(compuHng)
67.
No need to wait for the enHre resource to load
68.
Streams Inherit from Event Emi_er
69.
Streams are Everywhere! • HTTP requests and responses • Standard input/output (stdin&stdout) •
File reads and writes
70.
List naHve Node.js objects implement the streaming interface
71.
Read & Write Steam
72.
Streams and Buffer Demo
73.
Results
74.
Streams Resources Stream automated workshop: hBps://github.com/substack/ stream-adventure $ sudo npm install -g stream-adventure $ stream-adventure hBps://github.com/substack/stream-handbook
75.
How to scale a single threaded system?
76.
Cluster Usage • Master: starts workers • Worker: do the job, e.g., HTTP server •
Number of processes = number of CPUs
77.
Cluster
78.
pm2 hBps://github.com/Unitech/pm2 hBp://pm2.keymetrics.io Advantages: • Load-balancer and other features • 0s reload down-Hme, i.e., forever alive •
Good test coverage
79.
Node.js at Urbanhire
80.
99.5% Urbanhire code write with Node.js
81.
Use Case • Express REST API (Microservices) • Scraping engine •
RealHme NoHficaHon • Streaming data from MongoDB to ElasHcserch • Queue message with NSQ • Cronjob
82.
One Last Thing
83.
Atwood’s Law Any applicaHon that can be wriBen in JavaScript, will eventually be writen in JavaScript Codinghorror.com
84.
Thank You Be a part our Team hBps://www.urbanhire.com/careers
Jetzt herunterladen