SlideShare a Scribd company logo
1 of 23
Follow your code: Node/V8 tracing
Gireesh Punathil, 26th Aug 2016
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
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Philosophy of event-driven programming
Traditional synchronous multi-threaded model Asynchronous event driven model
Source: http://bit.ly/2baQkwp
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
4
dns
file
net
timer
Hello event driven
world!
=> dnscb
127.0.0.1
=> fscb
Name: node …
=> netcb
<html> …
=> timercb
I am timed out
Anatomy of event loop
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
var a = 10
var 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
Thursday, August 25, 2016EclipseSummit 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
Thursday, August 25, 2016EclipseSummit 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
Thursday, August 25, 2016EclipseSummit 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
Thursday, August 25, 2016EclipseSummit 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!
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing the script
Purpose
Trace Javascript functions with input and output
Output
Syntax (Heavy profile)
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Log APIs
Purpose
Collect all the V8 API calls emanating from the application
Output
Syntax
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Log Script execution
Purpose
Collect all the script / function information as and when they are loaded
/ compiled / recompiled
Output
Syntax
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Garbage Collection
Purpose
Trace load in the v8 heap and collection patterns
Output
Syntax
Scavenge collection
Mark-sweep collection
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Call Sequence
Purpose
Trace the code flow path on uncaught exception scenarios
Output
Syntax
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Compilation
Purpose
Trace optimize compilation decisions and their reasons
Output
Syntax
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Tracing Compiled Code
Purpose
Trace the generated native code for the Javascript source
Output
Syntax
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Selectively disable Compilation
Purpose
Identify and omit optimize compilation on problematic methods
Output
Syntax
Thursday, August 25, 2016EclipseSummit 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
Thursday, August 25, 2016EclipseSummit 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!
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
Thursday, August 25, 2016EclipseSummit 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
Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing

More Related Content

Similar to Follow your code: Node tracing

Similar to Follow your code: Node tracing (20)

Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Gestire la qualità del codice con Visual Studio, SonarQube ed Azure Devops
Gestire la qualità del codice con Visual Studio, SonarQube ed Azure DevopsGestire la qualità del codice con Visual Studio, SonarQube ed Azure Devops
Gestire la qualità del codice con Visual Studio, SonarQube ed Azure Devops
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
Jon Stace Web Cryptography API
Jon Stace Web Cryptography APIJon Stace Web Cryptography API
Jon Stace Web Cryptography API
 
A (XPages) developers guide to Cloudant
A (XPages) developers guide to CloudantA (XPages) developers guide to Cloudant
A (XPages) developers guide to Cloudant
 
OWASP Testing Guide v3
OWASP Testing Guide v3OWASP Testing Guide v3
OWASP Testing Guide v3
 
Owasp Eu Summit 2008 Owasp Testing Guide V3
Owasp Eu Summit 2008 Owasp Testing Guide V3Owasp Eu Summit 2008 Owasp Testing Guide V3
Owasp Eu Summit 2008 Owasp Testing Guide V3
 
Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016Angular2 & Native Script GDG DevFest 2016
Angular2 & Native Script GDG DevFest 2016
 
Swift 2.2 Design Patterns CocoaConf Austin 2016
Swift 2.2 Design Patterns CocoaConf Austin 2016Swift 2.2 Design Patterns CocoaConf Austin 2016
Swift 2.2 Design Patterns CocoaConf Austin 2016
 
PopcornSAR Specialized in AUTOSAR_Company profile
PopcornSAR Specialized in AUTOSAR_Company profilePopcornSAR Specialized in AUTOSAR_Company profile
PopcornSAR Specialized in AUTOSAR_Company profile
 
DSAG Jahreskongress 2018 - DevOps and Deployment Pipelines in SAP ABAP Landsc...
DSAG Jahreskongress 2018 - DevOps and Deployment Pipelines in SAP ABAP Landsc...DSAG Jahreskongress 2018 - DevOps and Deployment Pipelines in SAP ABAP Landsc...
DSAG Jahreskongress 2018 - DevOps and Deployment Pipelines in SAP ABAP Landsc...
 
VSSML16 L7. REST API, Bindings, and Basic Workflows
VSSML16 L7. REST API, Bindings, and Basic WorkflowsVSSML16 L7. REST API, Bindings, and Basic Workflows
VSSML16 L7. REST API, Bindings, and Basic Workflows
 
Everybody loves Swagger
Everybody loves SwaggerEverybody loves Swagger
Everybody loves Swagger
 
SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진SpringOne Platform recap 정윤진
SpringOne Platform recap 정윤진
 
Test Automation Frameworks: Assumptions, Concepts & Tools
Test Automation Frameworks: Assumptions, Concepts & ToolsTest Automation Frameworks: Assumptions, Concepts & Tools
Test Automation Frameworks: Assumptions, Concepts & Tools
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 
Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015
Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015
Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015
 
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring bootJavaeeconf 2016 how to cook apache kafka with camel and spring boot
Javaeeconf 2016 how to cook apache kafka with camel and spring boot
 
Appium workshop technopark trivandrum
Appium workshop technopark trivandrumAppium workshop technopark trivandrum
Appium workshop technopark trivandrum
 
Create and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and BluemixCreate and Manage APIs with API Connect, Swagger and Bluemix
Create and Manage APIs with API Connect, Swagger and Bluemix
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 

Recently uploaded (20)

SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purityAPVP,apvp apvp High quality supplier safe spot transport, 98% purity
APVP,apvp apvp High quality supplier safe spot transport, 98% purity
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 

Follow your code: Node tracing

  • 1. Follow your code: Node/V8 tracing Gireesh Punathil, 26th Aug 2016
  • 2. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 3. Philosophy of event-driven programming Traditional synchronous multi-threaded model Asynchronous event driven model Source: http://bit.ly/2baQkwp Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 4. 4 dns file net timer Hello event driven world! => dnscb 127.0.0.1 => fscb Name: node … => netcb <html> … => timercb I am timed out Anatomy of event loop Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 5. var a = 10 var 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 6. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 7. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 8. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 9. 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! Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 10. Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 11. Tracing the script Purpose Trace Javascript functions with input and output Output Syntax (Heavy profile) Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 12. Log APIs Purpose Collect all the V8 API calls emanating from the application Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 13. Log Script execution Purpose Collect all the script / function information as and when they are loaded / compiled / recompiled Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 14. Tracing Garbage Collection Purpose Trace load in the v8 heap and collection patterns Output Syntax Scavenge collection Mark-sweep collection Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 15. Tracing Call Sequence Purpose Trace the code flow path on uncaught exception scenarios Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 16. Tracing Compilation Purpose Trace optimize compilation decisions and their reasons Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 17. Tracing Compiled Code Purpose Trace the generated native code for the Javascript source Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 18. Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 19. Selectively disable Compilation Purpose Identify and omit optimize compilation on problematic methods Output Syntax Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 20. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 21. 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! Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 22. Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing
  • 23. 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 Thursday, August 25, 2016EclipseSummit 2016, Bangalore Follow your code: Node / V8 tracing