SlideShare una empresa de Scribd logo
1 de 12
Descargar para leer sin conexión
Node.js In Production At Joyent

__

.
.
_| |_
| .-. . . .-. :--. ||_
_|
;|
|| |(.-' | | |
|__|
`--' `-' `;-| `-' ' ' `-'
/ ;
`-'
Node.js at Joyent:
Engineering for Production
Joshua M. Clulow
jmc@joyent.com

Joshua M. Clulow

@jmclulow

⊕ Joyent
Node.js In Production At Joyent
node-vasync
Observable Asynchronous Control Flow
* Written by Dave Pacheco (Joyent)
davepacheco/node-vasync on github
* Similar in concept to caolan/async, but with a focus
on observability
* Returns status objects updated as flow progresses that
can be inspected in core files, or exported via web
services or REPLs
* Provides the barrier() primitive: specify some set of
named operations (you can extend the set mid-flight)
and get a drain event when they all complete

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Kang
Distributed System Observability
* Written by Dave Pacheco (Joyent)
davepacheco/kang on github
* A library for exposing self-describing state from
a set of processes via a web service
* A client library and command-line tool for collecting,
aggregating and inspecting that state
* The exposed state is a set of "objects" arranged by
"type", formatted as a JSON payload

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Post-mortem Debugging
* Traditionally done for C software on UNIX systems
* A program could call abort(), or some signals
(e.g. SIGSEGV) would end the program and write
a core file
* The program can be restarted immediately so that
service may be restored
* Engineers can inspect this core file later with
a debugger, similar to a black box flight recorder
* Operators may also generate a core file without
interrupting the program using gcore(1)

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Post-mortem Debugging in Node.js
* From node v0.10.8 onwards, we can abort() on
an uncaught exception by using:
node 
--abort-on-uncaught-exception 
app.js
* This preserves the stack that caused the exception
in the core file, where we can see it in the
debugger
* Use this flag everywhere!

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
mdb(1)
The Modular Debugger
* The illumos (and SmartOS) debugger
* Supports node core files through mdb_v8.so
::jsstack
-- Javascript stack traces
::findjsobjects
-- inspect all Javascript heap objects
::jsprint
-- print properties of a single object

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
DTrace
Production-safe Dynamic Instrumentation
* Zero disabled overhead; low enabled overhead
* In-kernel aggregation for high quantity events
* First class support for handling JSON-formatted
payloads with the json() subroutine
* Add semantically interesting probe points to
your applications with chrisa/node-dtrace-provider
* Easily measure latency between events and plot the
distribution

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Bunyan
JSON-formatted Logging Library
* Written by Trent Mick (Joyent)
trentm/node-bunyan on github
* Logs should be formatted for machines,
not for people
* Use a filter to make them human-readable
* Log auditing information at INFO to files
* Log verbosely (off by default) to DEBUG, and
consume those logs via DTrace probes (bunyan -p)
(uses node-dtrace-provider!)

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Restify
REST framework for Web Service APIs
* Written by Mark Cavage (Joyent)
mcavage/node-restify on github
* Route handler chains, like Express
* Built-in DTrace probes to measure per-route and
per-handler latency
* Easy integration with Bunyan for logging

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
Flamegraphs
Profiling and Call Stack Visualisation
* A node implementation, davepacheco/node-stackvis,
based on Brendan Gregg's original Flamegraph work
* Use DTrace to profile the application, i.e. regularly
sample the current stack
* Collect the like components of each sample and draw them
together to give a picture of where the program
spends its on-CPU time
* Pipe your stacks through c++filt to demangle the C++
method names

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent
General Development Tips
* Compile C/C++ code with -fno-omit-frame-pointer,
so that stack traces work in DTrace and mdb(1)
* Prefix your property names, making them easier to
find when debugging core files, e.g.
var iface = { if_id:
0x3423,
if_name:
'interface 0',
if_ipaddr: '192.168.1.1' };
* Name your 'anonymous' functions, making them easier
to identify in stack traces

Joshua M. Clulow

⊕ Joyent
Node.js In Production At Joyent

Thanks For Listening!
Read more about our Node.js Engineering Practices:
http://www.joyent.com/developers/node

Joshua M. Clulow

⊕ Joyent

Más contenido relacionado

La actualidad más candente

USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
Brendan Gregg
 
Open stack day 2014 havana from grizzly
Open stack day 2014 havana from grizzlyOpen stack day 2014 havana from grizzly
Open stack day 2014 havana from grizzly
Choe Cheng-Dae
 

La actualidad más candente (20)

Portable TeX Documents (PTD): PackagingCon 2021
Portable TeX Documents (PTD): PackagingCon 2021Portable TeX Documents (PTD): PackagingCon 2021
Portable TeX Documents (PTD): PackagingCon 2021
 
LXC – NextGen Virtualization for Cloud benefit realization (cloudexpo)
LXC – NextGen Virtualization for Cloud benefit realization (cloudexpo)LXC – NextGen Virtualization for Cloud benefit realization (cloudexpo)
LXC – NextGen Virtualization for Cloud benefit realization (cloudexpo)
 
Evolution of Openstack Networking at CERN
Evolution of Openstack Networking at CERNEvolution of Openstack Networking at CERN
Evolution of Openstack Networking at CERN
 
LXC
LXCLXC
LXC
 
NetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded SystemsNetBSD and Linux for Embedded Systems
NetBSD and Linux for Embedded Systems
 
Kqueue : Generic Event notification
Kqueue : Generic Event notificationKqueue : Generic Event notification
Kqueue : Generic Event notification
 
An Updated Performance Comparison of Virtual Machines and Linux Containers
An Updated Performance Comparison of Virtual Machines and Linux ContainersAn Updated Performance Comparison of Virtual Machines and Linux Containers
An Updated Performance Comparison of Virtual Machines and Linux Containers
 
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
 
Containers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux KernelContainers and Namespaces in the Linux Kernel
Containers and Namespaces in the Linux Kernel
 
Let's Containerize New York with Docker!
Let's Containerize New York with Docker!Let's Containerize New York with Docker!
Let's Containerize New York with Docker!
 
Docker vs kvm
Docker vs kvmDocker vs kvm
Docker vs kvm
 
Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)Realizing Linux Containers (LXC)
Realizing Linux Containers (LXC)
 
Introduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange CountyIntroduction to Docker at Glidewell Laboratories in Orange County
Introduction to Docker at Glidewell Laboratories in Orange County
 
Docker storage drivers by Jérôme Petazzoni
Docker storage drivers by Jérôme PetazzoniDocker storage drivers by Jérôme Petazzoni
Docker storage drivers by Jérôme Petazzoni
 
Shifter: Containers in HPC Environments
Shifter: Containers in HPC EnvironmentsShifter: Containers in HPC Environments
Shifter: Containers in HPC Environments
 
Introduction to Docker and deployment and Azure
Introduction to Docker and deployment and AzureIntroduction to Docker and deployment and Azure
Introduction to Docker and deployment and Azure
 
Linux cgroups and namespaces
Linux cgroups and namespacesLinux cgroups and namespaces
Linux cgroups and namespaces
 
Open stack day 2014 havana from grizzly
Open stack day 2014 havana from grizzlyOpen stack day 2014 havana from grizzly
Open stack day 2014 havana from grizzly
 
How Linux Processes Your Network Packet - Elazar Leibovich
How Linux Processes Your Network Packet - Elazar LeibovichHow Linux Processes Your Network Packet - Elazar Leibovich
How Linux Processes Your Network Packet - Elazar Leibovich
 
Kubernetes networking
Kubernetes networkingKubernetes networking
Kubernetes networking
 

Similar a Node.js at Joyent: Engineering for Production

Similar a Node.js at Joyent: Engineering for Production (20)

Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Nodejs Intro Part One
Nodejs Intro Part OneNodejs Intro Part One
Nodejs Intro Part One
 
App container rkt
App container rktApp container rkt
App container rkt
 
Building an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache GroovyBuilding an Extensible, Resumable DSL on Top of Apache Groovy
Building an Extensible, Resumable DSL on Top of Apache Groovy
 
Docker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBMDocker Multi Host Networking, Rachit Arora, IBM
Docker Multi Host Networking, Rachit Arora, IBM
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
Top 10 Most Important Interview Question of Node JS.
Top 10 Most Important  Interview Question of Node JS.Top 10 Most Important  Interview Question of Node JS.
Top 10 Most Important Interview Question of Node JS.
 
Node js meetup
Node js meetupNode js meetup
Node js meetup
 
Making your app soar without a container manifest
Making your app soar without a container manifestMaking your app soar without a container manifest
Making your app soar without a container manifest
 
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorGr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Eclipsecon 2017 presentation
Eclipsecon 2017 presentationEclipsecon 2017 presentation
Eclipsecon 2017 presentation
 
NFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center OperationsNFD9 - Matt Peterson, Data Center Operations
NFD9 - Matt Peterson, Data Center Operations
 
oSC22ww4.pdf
oSC22ww4.pdfoSC22ww4.pdf
oSC22ww4.pdf
 
RunX ELCE 2020
RunX ELCE 2020RunX ELCE 2020
RunX ELCE 2020
 
Jdk Tools For Performance Diagnostics
Jdk Tools For Performance DiagnosticsJdk Tools For Performance Diagnostics
Jdk Tools For Performance Diagnostics
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Node.js at Joyent: Engineering for Production

  • 1. Node.js In Production At Joyent __ . . _| |_ | .-. . . .-. :--. ||_ _| ;| || |(.-' | | | |__| `--' `-' `;-| `-' ' ' `-' / ; `-' Node.js at Joyent: Engineering for Production Joshua M. Clulow jmc@joyent.com Joshua M. Clulow @jmclulow ⊕ Joyent
  • 2. Node.js In Production At Joyent node-vasync Observable Asynchronous Control Flow * Written by Dave Pacheco (Joyent) davepacheco/node-vasync on github * Similar in concept to caolan/async, but with a focus on observability * Returns status objects updated as flow progresses that can be inspected in core files, or exported via web services or REPLs * Provides the barrier() primitive: specify some set of named operations (you can extend the set mid-flight) and get a drain event when they all complete Joshua M. Clulow ⊕ Joyent
  • 3. Node.js In Production At Joyent Kang Distributed System Observability * Written by Dave Pacheco (Joyent) davepacheco/kang on github * A library for exposing self-describing state from a set of processes via a web service * A client library and command-line tool for collecting, aggregating and inspecting that state * The exposed state is a set of "objects" arranged by "type", formatted as a JSON payload Joshua M. Clulow ⊕ Joyent
  • 4. Node.js In Production At Joyent Post-mortem Debugging * Traditionally done for C software on UNIX systems * A program could call abort(), or some signals (e.g. SIGSEGV) would end the program and write a core file * The program can be restarted immediately so that service may be restored * Engineers can inspect this core file later with a debugger, similar to a black box flight recorder * Operators may also generate a core file without interrupting the program using gcore(1) Joshua M. Clulow ⊕ Joyent
  • 5. Node.js In Production At Joyent Post-mortem Debugging in Node.js * From node v0.10.8 onwards, we can abort() on an uncaught exception by using: node --abort-on-uncaught-exception app.js * This preserves the stack that caused the exception in the core file, where we can see it in the debugger * Use this flag everywhere! Joshua M. Clulow ⊕ Joyent
  • 6. Node.js In Production At Joyent mdb(1) The Modular Debugger * The illumos (and SmartOS) debugger * Supports node core files through mdb_v8.so ::jsstack -- Javascript stack traces ::findjsobjects -- inspect all Javascript heap objects ::jsprint -- print properties of a single object Joshua M. Clulow ⊕ Joyent
  • 7. Node.js In Production At Joyent DTrace Production-safe Dynamic Instrumentation * Zero disabled overhead; low enabled overhead * In-kernel aggregation for high quantity events * First class support for handling JSON-formatted payloads with the json() subroutine * Add semantically interesting probe points to your applications with chrisa/node-dtrace-provider * Easily measure latency between events and plot the distribution Joshua M. Clulow ⊕ Joyent
  • 8. Node.js In Production At Joyent Bunyan JSON-formatted Logging Library * Written by Trent Mick (Joyent) trentm/node-bunyan on github * Logs should be formatted for machines, not for people * Use a filter to make them human-readable * Log auditing information at INFO to files * Log verbosely (off by default) to DEBUG, and consume those logs via DTrace probes (bunyan -p) (uses node-dtrace-provider!) Joshua M. Clulow ⊕ Joyent
  • 9. Node.js In Production At Joyent Restify REST framework for Web Service APIs * Written by Mark Cavage (Joyent) mcavage/node-restify on github * Route handler chains, like Express * Built-in DTrace probes to measure per-route and per-handler latency * Easy integration with Bunyan for logging Joshua M. Clulow ⊕ Joyent
  • 10. Node.js In Production At Joyent Flamegraphs Profiling and Call Stack Visualisation * A node implementation, davepacheco/node-stackvis, based on Brendan Gregg's original Flamegraph work * Use DTrace to profile the application, i.e. regularly sample the current stack * Collect the like components of each sample and draw them together to give a picture of where the program spends its on-CPU time * Pipe your stacks through c++filt to demangle the C++ method names Joshua M. Clulow ⊕ Joyent
  • 11. Node.js In Production At Joyent General Development Tips * Compile C/C++ code with -fno-omit-frame-pointer, so that stack traces work in DTrace and mdb(1) * Prefix your property names, making them easier to find when debugging core files, e.g. var iface = { if_id: 0x3423, if_name: 'interface 0', if_ipaddr: '192.168.1.1' }; * Name your 'anonymous' functions, making them easier to identify in stack traces Joshua M. Clulow ⊕ Joyent
  • 12. Node.js In Production At Joyent Thanks For Listening! Read more about our Node.js Engineering Practices: http://www.joyent.com/developers/node Joshua M. Clulow ⊕ Joyent