SlideShare a Scribd company logo
Observable
Applications w/ Node.js
Yunong Xiao, Senior Node.js Engineer,
UI Platform, Netflix
@yunongx, yunong@netflix.com
March 2015
BayNode
The Bay Area Node.js Meetup
Node.js @
Netflix
• Website www.netflix.com
• Discovery
• Playback
• Acquisition
• Account Management
• Internal Services
• TV/Mobile/Devices
What’s Wrong?
Increased Errors Increased Latency
Memory Leak
What Now?
“It is a capital mistake to
theorize before one has DATA.
Insensibly one begins to twist
facts to suit theories, instead of
theories to suit facts.”
Sherlock Holmes
-A Scandal in Bohemia
Data Data Data
Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014
Node.js Modules
Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014
Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014
Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014
vasync
• https://github.com/davepacheco/node-vasync
• Similar to caolan/async.
• Added observability.
async f() state
failed f()
successful f()
pending f()
finished f()
# of errors
vasync
• Make API requests.
• Persist state to file system.
• Query database.
• Update caches.
Async workflow management is error prone
Example
cb() not invoked
Results
function three pending
How Do I See this in Prod?
• Logs
• Core Dumps
• REPL
• HTTP API
node-bunyan
• https://github.com/trentm/node-bunyan
• Streaming JSON logging library for JS. (node
and browser)
Streaming JSON
• One JSON object per line. e.g. Twitter’s
streaming API.
• Perfect for machine processing. i.e. works with
Unix tools such as grep(1), cut(1), …
• Illegible for Humans
Streaming JSON
bunyan(1) CLI
Features
• Lightweight API
• Log levels: trace, debug, info, warn, error, fatal
• Extensible Streams interface.
• Custom object rendering with serializers.
• DTrace support.
Demo
DTrace
• Dynamic tracing framework.
• Available on Mac OS X (dev env). `man dtrace`
• Node.js DTrace USDT provider: https://
github.com/chrisa/node-dtrace-provider
• Pure JS probes.
bunyan -p
Demo
Production Tracing
• Production environment is Ubuntu Linux on EC2.
• Future work: get probe access. Possibilities:
• SystemTap
• LTTng (Linux Tracing Toolkit Next Gen)
• perf_events markers (currently a proposed
patch)
restify
• http://restifyjs.com
• Production tested REST framework.
• Observability.
• Metrics.
• First class Bunyan integration.
• DTrace.
Vanilla App
Vanilla App
Logging
Request Capture Stream
• Tradeoffs, Perf vs Verbosity.
• Captures all log statements including trace in
memory.
• Dump all logs only on error.
Audit Logs
Audit Logsstatus code request ID (UUID)
URL
request headers
response headers
individual handler timers
req latency
Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014
Scoped Child Loggers
Logging
• Native Bunyan integration.
• Request capture stream.
• Audit logs with each req.
• Scoped child loggers with each req.
restify + Bunyan
• Streaming JSON.
• Processing using Unix tools is easy.
• Helpful tools:
• Unix: cut(1), wc(1), grep(1), awk(1), perl(1), …
• JSON: https://github.com/trentm/json (npm install -g
json)
• daggr: https://github.com/joyent/daggr (npm install -g
daggr)
Examples
• Find all logs for a specific request.
• Count the # of non-200 responses.
• Show all requests that took longer than 200ms.
Advanced Example
Request latency distribution by URL
DTrace
Demo
distributed
processing
• elasticsearch
• spark
• hive
bunyanrestify
audit logs
req id req headers
req latency
handler
latencies
URL
res codeErrors
res headers
Processing
w/ Unix tools
• grep(1)
• awk(1)
• cut(1)
• wc(1)
• sort(1)
• json(1)
• bunyan(1)
• …
req scoped logs
application specific
context
req capture stream
dumps all logs on error
DTrace*
req latency
handler
latencies
* Where available
restify metrics
Increased Errors Increased Latency
restify
Interested? Call for contributors.
restifyjs.com
The Killer Combo
• vasync: https://github.com/davepacheco/node-vasync
• Observable async operations.
• bunyan: https://github.com/trentm/node-bunyan
• Streaming JSON logs.
• restify: restifyjs.com
• Observable REST applications.
• Unix Tools
• Stream of text model. Many tools to manipulate JSON logs.
Data Data Data
Thanks
• Questions?
• yunong@netflix.com
• @yunongx
• http://restifyjs.com
March 2015
BayNode
The Bay Area Node.js Meetup

More Related Content

What's hot (20)

PDF
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
PPTX
How go makes us faster (May 2015)
Wilfried Schobeiri
 
PDF
Kubernetes DNS Horror Stories
Laurent Bernaille
 
PDF
How to stay sane during your Vagrant journey
Jakub Wadolowski
 
PDF
(Re)discover your AEM
Jakub Wadolowski
 
PDF
Large-scaled Deploy Over 100 Servers in 3 Minutes
Hiroshi SHIBATA
 
PDF
Performance Analysis Tools for Linux Kernel
lcplcp1
 
PDF
Regex Considered Harmful: Use Rosie Pattern Language Instead
All Things Open
 
PDF
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
Tim Bunce
 
PDF
NBIS RNA-seq course
Phil Ewels
 
PDF
Extending Kubernetes – Admission webhooks
Stefan Schimanski
 
PDF
Perl Dist::Surveyor 2011
Tim Bunce
 
PDF
10 ways to shoot yourself in the foot with kubernetes, #9 will surprise you! ...
Laurent Bernaille
 
PDF
LISA17 Container Performance Analysis
Brendan Gregg
 
PDF
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Valeriy Kravchuk
 
PDF
Netflix: From Clouds to Roots
Brendan Gregg
 
PDF
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
Vadym Kazulkin
 
PDF
Into The Box 2018 Going live with commandbox and docker
Ortus Solutions, Corp
 
PPTX
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
ngotogenome
 
PDF
Making the most out of kubernetes audit logs
Laurent Bernaille
 
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
How go makes us faster (May 2015)
Wilfried Schobeiri
 
Kubernetes DNS Horror Stories
Laurent Bernaille
 
How to stay sane during your Vagrant journey
Jakub Wadolowski
 
(Re)discover your AEM
Jakub Wadolowski
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Hiroshi SHIBATA
 
Performance Analysis Tools for Linux Kernel
lcplcp1
 
Regex Considered Harmful: Use Rosie Pattern Language Instead
All Things Open
 
Devel::NYTProf 2009-07 (OUTDATED, see 201008)
Tim Bunce
 
NBIS RNA-seq course
Phil Ewels
 
Extending Kubernetes – Admission webhooks
Stefan Schimanski
 
Perl Dist::Surveyor 2011
Tim Bunce
 
10 ways to shoot yourself in the foot with kubernetes, #9 will surprise you! ...
Laurent Bernaille
 
LISA17 Container Performance Analysis
Brendan Gregg
 
Tracing MariaDB server with bpftrace - MariaDB Server Fest 2021
Valeriy Kravchuk
 
Netflix: From Clouds to Roots
Brendan Gregg
 
"Highlights from Java 10&11 and Future of Java" at Java User Group Bonn 2018 ...
Vadym Kazulkin
 
Into The Box 2018 Going live with commandbox and docker
Ortus Solutions, Corp
 
Running Ruby on Solaris (RubyKaigi 2015, 12/Dec/2015)
ngotogenome
 
Making the most out of kubernetes audit logs
Laurent Bernaille
 

Similar to Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014 (20)

PDF
Observable Node.js Applications - EnterpriseJS
Yunong Xiao
 
KEY
NodeJS
.toster
 
KEY
Dcjq node.js presentation
async_io
 
KEY
A million connections and beyond - Node.js at scale
Tom Croucher
 
KEY
Node.js Presentation Rotterdam.PHP
Joris Verbogt
 
PDF
node.js in production: Reflections on three years of riding the unicorn
bcantrill
 
PDF
Matthew Eernisse, NodeJs, .toster {webdev}
.toster
 
PDF
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
PDF
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
PDF
Instrumenting the real-time web: Node.js in production
bcantrill
 
PPT
Node js beginner
Sureshreddy Nalimela
 
KEY
Practical Use of MongoDB for Node.js
async_io
 
PPTX
Building and Scaling Node.js Applications
Ohad Kravchick
 
PDF
Introduction to Node.js
Somkiat Puisungnoen
 
PPTX
Introduction to node.js
Arun Kumar Arjunan
 
PDF
Node.js scaling in highload
Timur Shemsedinov
 
PPTX
StrongLoop Overview
Shubhra Kar
 
PDF
Node.js introduction
Prasoon Kumar
 
PDF
Node.js at Joyent: Engineering for Production
jclulow
 
PDF
Hello world - intro to node js
Refresh Annapolis Valley
 
Observable Node.js Applications - EnterpriseJS
Yunong Xiao
 
NodeJS
.toster
 
Dcjq node.js presentation
async_io
 
A million connections and beyond - Node.js at scale
Tom Croucher
 
Node.js Presentation Rotterdam.PHP
Joris Verbogt
 
node.js in production: Reflections on three years of riding the unicorn
bcantrill
 
Matthew Eernisse, NodeJs, .toster {webdev}
.toster
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
Instrumenting the real-time web: Node.js in production
bcantrill
 
Node js beginner
Sureshreddy Nalimela
 
Practical Use of MongoDB for Node.js
async_io
 
Building and Scaling Node.js Applications
Ohad Kravchick
 
Introduction to Node.js
Somkiat Puisungnoen
 
Introduction to node.js
Arun Kumar Arjunan
 
Node.js scaling in highload
Timur Shemsedinov
 
StrongLoop Overview
Shubhra Kar
 
Node.js introduction
Prasoon Kumar
 
Node.js at Joyent: Engineering for Production
jclulow
 
Hello world - intro to node js
Refresh Annapolis Valley
 
Ad

Recently uploaded (20)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Ad

Building Observable Applications w/ Node.js -- BayNode Meetup, March 2014