Need to Node: Profiling Node.js Applications

Similar documents
profiling Node.js applications

ProdDiagNode - Version: 1. Production Diagnostics for Node Applications

NODE.JS MOCK TEST NODE.JS MOCK TEST I

Monitoring Agent for Tomcat 6.4 Fix Pack 4. Reference IBM

Java performance - not so scary after all

SELF-AWARE APPLICATIONS AUTOMATIC PRODUCTION DIAGNOSIS DINA GOLDSHTEIN

Application Management Webinar. Daniela Field

a Very Short Introduction to AngularJS

DNWSH - Version: 2.3..NET Performance and Debugging Workshop

Serverless Architecture Hochskalierbare Anwendungen ohne Server. Sascha Möllering, Solutions Architect

Hands-on Lab Session 9909 Introduction to Application Performance Management: Monitoring. Timothy Burris, Cloud Adoption & Technical Enablement

Use Page Speed to Optimize Your Web Site for Mobile

To Kill a Monolith: Slaying the Demons of a Monolith with Node.js Microservices on CloudFoundry. Tony Erwin,

IDWedgeKB Serial Port and NodeJS

Zing Vision. Answering your toughest production Java performance questions

ORACLE ENTERPRISE MANAGER 10g ORACLE DIAGNOSTICS PACK FOR NON-ORACLE MIDDLEWARE

Web Application Development

Tools. SWE 432, Fall Design and Implementation of Software for the Web

Effective Java Heap Memory Analysis on Enterprise-Scale SAP Memory Analyzer. Vedran Lerenc, SAP NetWeaver Java Server Technology October 11th 2007

Red Hat Fuse 7.1 Fuse Online Sample Integration Tutorials

J Optimizer 1.0 User Guide

J2EE Development Best Practices: Improving Code Quality

GlassFish v2.1 & Enterprise Manager. Alexis Moussine-Pouchkine Sun Microsystems

Microservices with Node.js

Ionic Tutorial. For Cross Platform Mobile Software Development

LIVE WEBINAR: MOBILE TESTING WITH APPIUM HOW TO MODIFY YOUR TESTS TO RUN ON ios10?

Red Hat Fuse 7.2 Fuse Online Sample Integration Tutorials

COMP 2406: Fundamentals of Web Applications. Fall 2013 Mid-Term Exam Solutions

Node.js. Node.js Overview. CS144: Web Applications

All other products, services and company names mentioned herein may be trademarks of their respective owners.

JVM and application bottlenecks troubleshooting

Memory. don t forget to take out the

Quick Desktop Application Development Using Electron

Timing programs with time

Testing NodeJS, REST APIs and MongoDB with UFT January 19, 2016

Enterprise Architect. User Guide Series. Profiling. Author: Sparx Systems. Date: 10/05/2018. Version: 1.0 CREATED WITH

Better Web Development with WebKit Remote Debugging. Ashutosh Jagdish Sharma Senior Computer Scientist Adobe Developer Track WWW 2012 Lyon

Enterprise Architect. User Guide Series. Profiling

J, K, L. Node.js require() method, 403 package.json, 401 streams functionality, 401 task() method, 401 use strict statement, 403

Getting started with Tabris.js Tutorial Ebook

LANGUAGE RUNTIME NON-VOLATILE RAM AWARE SWAPPING

BPM 7.5 Deployments and Troubleshooting

Data Types and the main Function

Profiling & Optimization

Programming in C# Jump Start. Jerry Nixon Microsoft Developer Evangelist Daren May President & Co-founder, Crank211

Garbage Collection. Steven R. Bagley

PERFVIEW..NET runtime performance and ETW event analysis tool

Presented by. Dheepa Iyer Managing Consultant. Commissioned for. Reston SharePoint User Group. SharePoint Framework. May 2017

Deliver faster time to insight with the latest visualization technologies

Sizing and Memory Settings for Sage X3 Web Server (Syracuse): Recommendations

MySQL as a Document Store. Ted Wennmark

Whitepaper Measuring, Analyzing, Tuning, and Controlling the Performance of Oracle ADF Applications

A practical introduction

Advance Mobile& Web Application development using Angular and Native Script

JS Event Loop, Promises, Async Await etc. Slava Kim

This tutorial is intended to make you comfortable in getting started with the Firebase backend platform and its various functions.

Choose OS and click on it

How to install HDSME Client Server?

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav

Module 6 Node.js and Socket.IO

Profiling & Optimization

Present and Future of the RhoMobile platform. Migrating legacy applications, Node.js on mobile devices right now and more

August, HPE Propel Microservices & Jumpstart

THE TROUBLE WITH MEMORY

JavaScript on the Command Line & PRATIK PATEL CTO TripLingo Labs

vsan Monitoring January 08, 2018

Intro to Flex Debugging and Profiling

JavaScript: the language of browser interactions. Claudia Hauff TI1506: Web and Database Technology

End User Monitoring. AppDynamics Pro Documentation. Version Page 1

Java vs JavaScript. For Enterprise Web Applications. Chris Bailey IBM Runtime Technologies IBM Corporation

WebAssembly what? why? whither? Ben L. Titzer Andreas Rossberg Google Germany

Runtime. The optimized program is ready to run What sorts of facilities are available at runtime

Sizing and Memory Settings for Sage X3 Web Server (Syracuse): Recommendations

Lesson 5 Nimbits. Chapter-6 L05: "Internet of Things ", Raj Kamal, Publs.: McGraw-Hill Education

Homework 8: Ajax, JSON and Responsive Design Travel and Entertainment Search (Bootstrap/Angular/AJAX/JSON/jQuery /Cloud Exercise)

Node.js With Steroids Make Better Node.js Application with Native Add-Ons

RAD SERVER. Marco Cantu, Delphi Product Manager

Web API Lab folder 07_webApi : webapi.jsp your testapijs.html testapijq.html that works functionally the same as the page testapidomjs.

Node Js Mongodb And Angularjs Webydo

Windows Azure Mobile Services

JVM Memory Model and GC

2015 NALIT Professional Development Seminar September 30, Tools for Mobile App Development

Intro to Couchbase Server for ColdFusion - Clustered NoSQL and Caching at its Finest

STARCOUNTER. Technical Overview

Ten interesting features of Google s Angular Project

Oracle Java SE Advanced for ISVs

ClearSpeed Visual Profiler

Detect, Diagnose and Solve Problems with Application Insights

Monitor Qlik Sense sites. Qlik Sense Copyright QlikTech International AB. All rights reserved.

<Insert Picture Here>

Core Programming skill class Practical/Projects class Creativity and Production class Graduation/Interview/Job Preparation class.

Node.js I Getting Started

Using Automated Network Management at Fiserv. June 2012

WA2583 React JavaScript Programming. Classroom Setup Guide. Web Age Solutions Inc.

EI-PaaS Node-RED Plug-ins User Manual

Monitoring Agent for Tomcat 6.4 Fix Pack 8. Reference IBM

Why GC is eating all my CPU? Aprof - Java Memory Allocation Profiler Roman Elizarov, Devexperts Joker Conference, St.

Zadara Enterprise Storage in

HTML5 Speedtest. by Federico Dossena Version 4.1, March

Lab 2 Examine More Development Features in IBM Worklight

Transcription:

Need to Node: Profiling Node.js Applications Patrick Mueller January 19, 2016

Questions during the Need to Node webinar? Post a question to Twitter with the hashtag: #needtonode 2

NodeSource is the Enterprise Node.js company offering a suite of products and professional services explicitly focused on the needs of Enterprise users of Node.js. 3

Agenda Introduction to profiling Node.js applications Explain what profiling applications means, and what kind of profiling is available for Node.js Show what insights are provided when profiling Node.js applications Demonstrate using the Node.js profilers 4

What is profiling? 5

What is profiling? Profiling is: capturing statistics while a program is running displaying those statistics with useful visualizations Provides deep view into application performance no more guessing at what your program is doing 6

What kind of profiling can I do with Node.js? Profiling Node.js applications V8 heap snapshot profiler - measures memory usage find memory leaks optimize memory use by your program V8 CPU profiler - measures function execution time find bottlenecks in your application optimize the performance of your program 7

What is profiling? What is the real value in profiling? Run your programs faster Run your programs with less RAM Find difficult to diagnose problems - leaking memory and code bottlenecks Save $$$!!! 8

What kind of insights does the heap snapshot profiler provide? 9

Heap Snapshot profiler What does the heap snapshot profiler do? While your program is running, generates a JSON-able description of all JavaScript objects allocated in your program at a specific point in time, and the references between those objects. This description is quite large; plan on 2x RAM usage of your application. Visualization shows object counts/sizes by constructor (class), and references to and from individual objects. 10

Heap Snapshot insights - counts/sizes per class (N Solid) 11

Heap Snapshot insights shallow size vs retained size shallow size - amount of memory this object uses just by itself; typically only relevant for Strings and Arrays retained size - total amount of memory this object is referencing that would be garbage collected (GC d) if this object was garbage collected - usually the more interesting number Heap Snapshots are typically grouped by constructor name, so literal objects are all lumped into Object 12

Heap Snapshot insights - snapshot diff (Chrome Dev Tools) From the time the first snapshot was taken, till the second snapshot was taken, 1156 new Point2D objects were created, and none were garbage collected 13

Heap Snapshot insights - which objects reference selected object (Chrome Dev Tools) This Point2D object is being referenced by this LeakyCache module variable 14

What kind of insights does CPU profiling provide? 15

CPU profiler What does the CPU profiler do? While your program is running, you can start the profiler, let it run for some number of seconds, and then stop the profiler. While the profiler is running, it collects the stack of functions being executed, at a sub-millisecond interval. When the profiler is stopped, that data is aggregated into a JSON-able object. Visualizations show object function call stacks, function execution time, and aggregate function call times. 16

CPU profiling insights - flame graph (N Solid) 17

CPU profiling insights total time vs self time total time - total elapsed time spent in a function self time -total elapsed time spent in a function, minus total time spent in functions called from this function source location of functions provided in profiling data name your functions, lest you see lots of functions named (anonymous function) 18

CPU profiling insights - sunburst (N Solid) 19

CPU profiling insights - treemap (N Solid) 20

CPU profiling insights- tablular view of functions (Chrome Dev Tools) 21

How do you get profiling information from Node.js applications? 22

Profiling tools v8-profiler package on npm manually instrument your application, load profile data into Chrome Dev Tools N Solid from NodeSource generate and display profiles at the click of a button 23

Profiling with v8-profiler using v8-profiler from npm npm install v8-profiler add v8-profiler to your package.json dependencies, if not running locally add code to your app for triggers for starting/stopping CPU profiles, and to generate heap snapshots the triggers will: call functions in v8-profiler save results of v8-profiler function calls into JSON files run your app and trigger the profiles you want to generate load JSON files into the Profiles tab of Chrome Dev Tools 24

Profiling with NodeSource s N Solid what is N Solid? N Solid is a fully compatible Node.js v4.x LTS runtime that has been enhanced to provide additional runtime diagnostics. Provides a web-based console to: monitor applications at scale, in production obtain process- and system- specific statistics for an individual application instance obtain and view CPU profiles and heap snapshots at the click of a button 25

Profiling with NodeSource s N Solid using N Solid Run your app with the N Solid runtime Open the N Solid Console in a browser, navigate to your application, press the buttons to generate a CPU profile or heap snapshot The results are shown in the N Solid Console, and the data is available to download for further analysis in Chrome Dev Tools 26

Demo time! sample applications being profiled: https://gist.github.com/pmuellr/2c7e9c7b95352d1b33e0 27

Get involved in building new profiling tools! follow the Node.js Tracing Work Group https://github.com/nodejs/tracing-wg/issues/38 write your own profiling visualizers CPU profiles and heap snapshots are just JSON! 28

N Solid references Download N Solid - free for development: https://nodesource.com/products/nsolid N Solid documentation: https://docs.nodesource.com/ Getting Started with N Solid: https://nodesource.com/blog/getting-started-with-nsolid-at-the-command-line/ Getting Started with the N Solid Console: https://nodesource.com/blog/getting-started-with-the-nsolid-console/ 29

V8 profiling references Google Developers - How to Record Heap Snapshots - introduction to heap snapshots: https://developers.google.com/web/tools/chrome-devtools/profile/memoryproblems/heap-snapshots Google Developers - Speed Up JavaScript Execution - introduction to CPU profiles: https://developers.google.com/web/tools/chrome-devtools/profile/rendering-tools/ js-execution v8-profiler package at npm - open source package exposing V8 s profiling APIs: https://www.npmjs.com/package/v8-profiler 30

Questions during the Need to Node webcast? post a question to Twitter with the hashtag #needtonode these slides at pmuellr.github.io/slides 31

Thank you. Patrick Mueller pmuellr@nodesource.com @pmuellr