follow your code: node tracing
TRANSCRIPT
Follow your code: Node/V8 tracing
Gireesh Punathil, 26th Aug 2016
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Agenda♨Overview of Node/V8 Runtime environment
♨Eclipse as a Node.js development platform
♨Debug Server-side Javascript through Browser
♨Overview of in-built tracing
♨Top tracing options in Node/V8
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Philosophy of event-driven programmingTraditional synchronous multi-threaded model
Asynchronous event driven model
Source: http://bit.ly/2baQkwp
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing 4
dns
file
net
timer
Hello event driven world!
=> dnscb127.0.0.1
=> fscbName: node …
=> netcb<html> …
=> timercbI am timed out
Anatomy of event loop
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
var a = 10var b = ‘g’var c = new Object()
res.on(‘data’, function(d) { data += d});
dynamic typing
async, event driven
born for the cloud
isomorphic
single threaded
Major features of Node.js
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Eclipse for Node.js
Node.js a first class citizen in Eclipse
Nodeclipse is the Eclipse plugin for the Node.js
Professional Node.js development made easy, productive and a cool experience
Syntax high-lighting, in-built semantic validation, live debugging, Content assist and much more
Active community support
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Prepare Eclipse for Node.js Get the latest Node.js
Get the latest Java
Get the latest Eclipse
In Eclipse install new software
Switch to Node perspective
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Debug Server side script in the browser♨Server side code can be very large
♨Quite difficult to follow the control flow and logic
♨console logging very inefficient, and bad practice
♨Native debugging is even more complex
♨At the same time, vetting critical for reliable production
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Debug Server side script in the browser♨Install a debugger module
♨Start the application in the debugger
♨Get the debugger port, and access it in the Browser
♨Start following the code!
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing the scriptPurposeTrace Javascript functions with input and output
Output
Syntax (Heavy profile)
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Log APIsPurposeCollect all the V8 API calls emanating from the application
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Log Script executionPurposeCollect all the script / function information as and when they are loaded / compiled / recompiled
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Garbage CollectionPurposeTrace load in the v8 heap and collection patterns
Output
Syntax
Scavenge collection
Mark-sweep collection
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Call SequencePurposeTrace the code flow path on uncaught exception scenarios
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing CompilationPurposeTrace optimize compilation decisions and their reasons
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Compiled CodePurposeTrace the generated native code for the Javascript source
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Selectively disable CompilationPurposeIdentify and omit optimize compilation on problematic methods
Output
Syntax
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Profile the application for Performance♨Manual profiling inefficient and impractical
♨Adding time measurement cause further burden
♨Native profilers do not provide Javascript insights
♨Large applications often contain performance hideouts
♨Precise performance measures is a hallmark qualifier for software modules
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Profile with v8 profiler, view with tick
♨Run the code inside light-weight profiler
♨Rename the generated log file to v8.log
♨Install tick module
♨Post-process the profile log
♨Start analyzing the profile!
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Wednesday, May 3, 2023
EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
For further learning♨Learn Node.js: https://nodejs.org/en/docs/
♨Learn Javascript: http://www.w3schools.com/js/
♨Learn V8: https://developers.google.com/v8/intro
♨Learn Nodeclipse: http://www.nodeclipse.org
♨Chrome developer tools: https://developer.chrome.com/devtools