Do you know how to debug node.js applications?
Submitted by: AdministratorThere's a few tools and ways out there:
Interactive Stack Traces with traceGL - Shareware
Guide here
Profiling with Profiler
Install globally npm install -g profiler
Start your process with node --prof this will create a v8.log file
Build nprof by running ~/.nvm/v0.8.22/lib/node_modules/profiler/tools/build-nprof
Run ~/.nvm/v0.8.22/lib/node_modules/profiler/nprof this will read the v8.log profile and give you nice ouput
CPU and Memory Profiling with NodeTime
Install to your app npm install nodetime
Include in your app require('nodetime').profile()
Follow the instructions it will output to console
Alternatively, you may want to use look, which is based on nodetime but doesn't send data to nodetime.com.
Blink (formerly Webkit) Developer Tools Debugging with Node Inspector
Install it globally: npm install -g node-inspector
Run your app in debug mode: node --debug-brk your/node/program.js (or attach to a running process: kill -s USR1 <your node process id>)
In another terminal window run node-inspector: node-inspector
Open http://127.0.0.1:8080/debug?port=5858 (or debug remotely by replacing 127.0.0.1 with your host; make sure port 8080 is open)
Webkit Developer Tools Profiling with Node Webkit Agent
Install to your app npm install webkit-devtools-agent
Include in your app agent = require('webkit-devtools-agent')
Activate the agent: kill -SIGUSR2 <your node process id>
Access the agent via the appropriate link
Interactive Cloud9 Debugging
Guide here
Heapdumps to Webkit Developer Tools
Tool and guide here
Logging Libraries that output Debugging Information
Caterpillar
Tracer
Flamegraphs with Dtrace and StackVis
Only supported on SmartOS
Flamegraphs with Chrome Developer Tools
Coming soon
Benchmark
with Apache Bench: ab -n 100000 -c 1 http://127.0.0.1:9778/
with wrk
Submitted by: Administrator
Interactive Stack Traces with traceGL - Shareware
Guide here
Profiling with Profiler
Install globally npm install -g profiler
Start your process with node --prof this will create a v8.log file
Build nprof by running ~/.nvm/v0.8.22/lib/node_modules/profiler/tools/build-nprof
Run ~/.nvm/v0.8.22/lib/node_modules/profiler/nprof this will read the v8.log profile and give you nice ouput
CPU and Memory Profiling with NodeTime
Install to your app npm install nodetime
Include in your app require('nodetime').profile()
Follow the instructions it will output to console
Alternatively, you may want to use look, which is based on nodetime but doesn't send data to nodetime.com.
Blink (formerly Webkit) Developer Tools Debugging with Node Inspector
Install it globally: npm install -g node-inspector
Run your app in debug mode: node --debug-brk your/node/program.js (or attach to a running process: kill -s USR1 <your node process id>)
In another terminal window run node-inspector: node-inspector
Open http://127.0.0.1:8080/debug?port=5858 (or debug remotely by replacing 127.0.0.1 with your host; make sure port 8080 is open)
Webkit Developer Tools Profiling with Node Webkit Agent
Install to your app npm install webkit-devtools-agent
Include in your app agent = require('webkit-devtools-agent')
Activate the agent: kill -SIGUSR2 <your node process id>
Access the agent via the appropriate link
Interactive Cloud9 Debugging
Guide here
Heapdumps to Webkit Developer Tools
Tool and guide here
Logging Libraries that output Debugging Information
Caterpillar
Tracer
Flamegraphs with Dtrace and StackVis
Only supported on SmartOS
Flamegraphs with Chrome Developer Tools
Coming soon
Benchmark
with Apache Bench: ab -n 100000 -c 1 http://127.0.0.1:9778/
with wrk
Submitted by: Administrator
Read Online Node.js Job Interview Questions And Answers
Top Node.js Questions
☺ | Explain Node.js Architecture? |
☺ | How to extract POST data in node.js? |
☺ | What is Node.js? |
☺ | Do you know how to debug node.js applications? |
☺ | Do you know how to get POST query in express node.js? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |