3. Node Core
Bert
Belder
Ben
Noordhuis
These guys sent me !
LoopBack/Express Core
Raymond
Feng
Ritchie
Martori
Sam
Roberts
Miroslav
Bajtos
Ryan
Graham
4. To do what ?
To give you a fresh pair of gloves
5. Let’s revisit the STORY
Let’s touch up our
SOA for
Mobile…and bring
Glass @ work
Architect Developer
6. The boss does have valid questions
I recommend
Node.js for our
API strategy
Node is nerdy like systems
programming !...Where are
tools ? Do we have an IDE ?
Architect The Boss
7. Node.js APIs actually have a life cycle
8
Reliable API Solutions powered by Node.js
Compose
Deploy / Scale
Monitor
Secure / Manage
API Studio Controller StrongOps API Gateway
Development Production
8. Let’s start by debugging
• Chrome debugger
• Debug Remotely on
Production
• Breakpoints &
uncaught exceptions
• Source Maps
• Unit test integration
• Display/edit variables
• Pre-loaded breaks
Known as Node-Inspector / StrongLoop-Debug
9. Debugging server side clustered apps
Debugging single process
slc debug app.js
Debugging clustered process in V11
slc debug app.js
http://localhost:8080/debug?port=<5858+ID-of-process>
Debugging clustered process in V10
%node debug –p <PID>
connecting…ok
…
debug>quit
%node-inspector
http://127.0.0.1:8080/debug?port =5858
Or
process._debugPort = 5858 + cluster.worker.id
10. Can Errors be stitched into a trace and recovered ?
Enter StrongLoop / Zones
11. But is it enough to convince him ?
Plus I can now
diagnose CPU
hotspots and Memory
Bottlenecks
Node is fast you said
!...what bottlenecks and
leaks ?
Architect The Boss
12. How to diagnose CPU hotspots upto line of code ?
Enter StrongLoop OSS - Node Profiler
slc runctl cpu-start/stop PID >> CPU Proc files
13. Can I visually see my hotspots ?
Chrome Dev Tools – For Server !
14. How about a fancy chart for my boss ?
Call Stack
Path and
function
CPU Cycle
times
15. Does Node have memory leaks ?
StrongLoop OSS - HeapSnapshots
slc runctl heap-snapshot PID
16. heapdump for V8 snapshots
npm install heapdump
Add to app : var heapdump = require(‘heapdump’)
Method 1 : writeSnapshot
var heapdump = require('heapdump')
...
heapdump.writeSnapshot()
Method 2 : SIGUSR2 (Unix only)
kill –USR2 <pid>
Make sure your directory is writable
process.chdir('/path/to/writeable/dir’)
22. And On-Demand Dynamic Instrumentation
Monkey
Patching
Agent App
Dynamic
Instrument
Agent App
• Live Edit
• Line Level
Instrumentation
• Any package, any
framework, any code
• Custom logic
• Counters, Gauges and
Timers
• HA rollback
23. Almost there …
Look I got
monitoring
Good…but before I promote
you, show me some scale
Architect The Boss
24. Vertical and pseudo-horizontal scaling
• OSS Controller
• Cluster Mgmt.
• Hot Deploy
• Rolling Restart
• Cluster State Mgmt.
• Process Mgmt.
• Deploy
25. MESH – All things distributed
• Distributed
Deploy
• Cross MC state
• HA
• Docker Containers
• Auto Scaling
• Process Mgmt.