Introduction To Profiling Node.js Applications - GitHub Pages

1y ago
16 Views
1 Downloads
7.75 MB
24 Pages
Last View : 3d ago
Last Download : 3m ago
Upload by : Genevieve Webb
Transcription

1 / 24

introduction to profiling Node.js applications Patrick Mueller @pmuellr, muellerware.org senior node engineer at NodeSource node-intro node-intro/slides.pdf http://pmuellr.github.io/slides/ (all of Patrick's slides) 2 / 24

profiling Node.js applications what kind of profiling? performance with V8's CPU profiler memory with V8's heap snapshots 3 / 24

profiling Node.js applications profiling performance 4 / 24

profiling performance profiling Node.js applications what does V8's CPU profiler do? trigger profiler on / off when on, at regular intervals, V8 will capture current stack trace, with time stamp, and source file / line numbers when turned off, profiler will aggregate the information, and produce a JSON data structure for analysis tools 5 / 24

profiling performance profiling Node.js applications understanding CPU profiling intro: Google Developers: Speed Up JavaScript Execution provides times spent executing functions: self time - time to run the function, not including any functions that it called total time - time to run the function, including any functions that it called 6 / 24

profiling performance profiling Node.js applications time-line from Chrome Dev Tools 7 / 24

profiling performance profiling Node.js applications table from Chrome Dev Tools 8 / 24

profiling performance profiling Node.js applications flame graph from N Solid 9 / 24

profiling performance profiling Node.js applications sunburst from N Solid 10 / 24

profiling performance profiling Node.js applications how can you get CPU profiles? npm v8-profiler (requires instrumenting your code) npm node-inspector StrongLoop arc NodeSource N Solid 11 / 24

profiling performance profiling Node.js applications demo time! expecting faster response time in app when load testing with ab - what's slowing down this app? source for the express-demo see the instructions in demos/README.md using N Solid - getting started info 12 / 24

profiling Node.js applications profiling memory 13 / 24

profiling memory profiling Node.js applications what are V8 heap snapshots? JSON file describing every reachable JavaScript object in the application; taking a snapshot always starts with a garbage collection JSON files are . large; figure 2x heap memory allocated by Node.js triggered via single native V8 call TakeHeapSnapshot() 14 / 24

profiling memory profiling Node.js applications understanding heap snapshots intro: Google Developers: Viewing Heap Snapshots object sizes/counts, grouped by constructor shallow size - the size of memory held by an object itself retained size - the size of memory that can be freed once an object is deleted 15 / 24

profiling memory profiling Node.js applications heapmap from Chrome Dev Tools 16 / 24

profiling memory profiling Node.js applications what kind of output can you get? large JSON file - could be 100's of MB; figure 2x allocated heap can "diff" snapshots to help identify leaks can drill into or out from references in Chrome Dev Tools; references / referenced by 17 / 24

profiling memory profiling Node.js applications how can you get heap snapshots? npm v8-profiler (requires instrumenting your code) npm node-inspector StrongLoop arc NodeSource N Solid 18 / 24

profiling memory profiling Node.js applications demo time! this app seems to be leaking memory - what objects are leaking? source for the express-demo see the instructions in demos/README.md using N Solid - getting started info 19 / 24

profiling Node.js applications profiling tips 20 / 24

profiling tips profiling Node.js applications profiling performance look for width in trace visualizations; height only shows stack trace which may not have any perf consequences "script" profiling a web server: start profile, run load tester, stop profile use node/v8 option --no-use-inlining to turn off function inlining; stack traces may make more sense (but no inlining!) 21 / 24

profiling tips profiling Node.js applications profiling memory easiest way to find a memory leak: take a heap snapshot; run load tester; take another heap snapshot; diff in Chrome Dev Tools 'tag' objects you think might be leaking w/easy to find class: req. tag new TagRequest() 22 / 24

profiling Node.js applications fin 23 / 24

profiling Node.js applications 24 / 24

profiling Node.js applications. profiling performance. look for width in trace visualizations; height only shows stack trace which may not have any perf consequences "script" profiling a web server: start profile, run load tester, stop profile use node/v8 option --no-use-inliningto turn off function inlining; stack traces may make more sense (but no inlining!)

Related Documents:

Tall With Spark Hadoop Worker Node Executor Cache Worker Node Executor Cache Worker Node Executor Cache Master Name Node YARN (Resource Manager) Data Node Data Node Data Node Worker Node Executor Cache Data Node HDFS Task Task Task Task Edge Node Client Libraries MATLAB Spark-submit script

5. Who uses Node.js 6. When to Use Node.js 7. When to not use Node.js Chapter 2: How to Download & Install Node.js - NPM on Windows 1. How to install Node.js on Windows 2. Installing NPM (Node Package Manager) on Windows 3. Running your first Hello world application in Node.js Chapter 3: Node.js NPM Tutorial: Create, Publish, Extend & Manage 1.

1/24/2017 profiling Node.js applications filing-node/index.html#2 14/24 understanding heap snapshots

a framework for assessment: recognising achievement, profiling and reporting 1 Contents Supplementary Information 2 Key Messages 3 Recognising Achievement, Profiling and Reporting 4 Principles underpinning recognising achievement, profiling and reporting 5 Planning recognising achievement, profiling and reporting 5 Manageability 5 Getting it Right for Every Child (GIRFEC) 6

CMSC 330 - Spring 2011 Recursive Descent: Basic Strategy ! Initially, “current node” is start node When processing the current node, 4 possibilities Node is the empty string Move to next node in DFS order that has not yet been processed Node is a terminal that matches lookahead Advance lookahead by one symbol and move to next node in

potential of node a or b with respect to the reference node, c. To solve for the unknown node voltages in this circuit, begin by applying Kirchhoff's current law at node a. Using Ohm’s Law, the current through R 1 and R 2 can be expressed in terms of the unknown node voltage at node

A RPL node may attach to a DODAG as a leaf node only. One example of such a case is when a node does not understand or does not support (policy) the RPL Instance's OF or advertised metric/constraint,the node may either join the DODAG as a leaf node or may not join the DODAG. A node operating as a leaf node must obey the following rules: 1.

ACCOUNTING 0452/12 Paper 1 October/November 2019 1 hour 45 minutes Candidates answer on the Question Paper. No Additional Materials are required. READ THESE INSTRUCTIONS FIRST Write your centre number, candidate number and name on all the work you hand in. Write in dark blue or black pen. You may use an HB pencil for any diagrams or graphs. Do not use staples, paper clips, glue or correction .