22
Shubhra Kar @shubhrakar April, 2014 DevOps

Node.js dev ops

Embed Size (px)

DESCRIPTION

Development, monitoring and management tools for Node.js applications

Citation preview

Page 1: Node.js dev ops

Shubhra Kar@shubhrakar

April, 2014

DevOps

Page 2: Node.js dev ops

Module reference

http://strongloop.com/get-started/

npm install –g strong-cli

Page 3: Node.js dev ops

Node.js modules (Sample set)

3

Node.js Core

strong-module-loader

strong-cluster-connect-

store

strong-cluster-control

SL-Config

Loopback Strong-mq

strong-task-emitter

Engine.io Mongoose

Strong-agent

strong-cluster-

socket.io-store

strong-config-loader

Request

Node-heapdump

Asynch

node-inspector

Passport

Strong-remoting

Q

EJS

Express

Connect

Socket.IO

Reggie Postgres Connector

Oracle Connector

SQL ServerConnector

MongoDBConnector

REST Connector

In-Memory connector

LIBUV

V8 Profiler

SOAP connector

ATG connector

iOS Remoting

& SDK

Angular& SDK

Android Remoting

/SDK

Page 4: Node.js dev ops

Setting up StrongOps

With SLC

$ slc strongopsfollow registration instructions$ sl run

W/O SLC

$ slc strongops$ npm install - - save strong-agentrequire(‘strong-agent’).profile();$ node app

http://docs.strongloop.com/display/DOC/Setting+up+StrongOps+monitoring

Page 5: Node.js dev ops

Debugging

http://docs.strongloop.com/display/DOC/Debugging+with+Node+Inspector

Debug mode

$ npm install –g node-inspector$ slc run$ slc debuGo to http://localhost:8080/debug?port=5858

Running mode

$ pgrep –l node$ 2345 node your/node/server.js

$ kill –s USR1 2345

Running with mocha

Pass –debug –brk optionLaunch node inspector

Page 8: Node.js dev ops

StrongOps - Memory Profiling and Leak Detection

Page 9: Node.js dev ops

A nasty one ! (memory leak)

Page 10: Node.js dev ops

heapdump for V8 snapshots by @bnoordhuis

npm install heapdumpAdd to app : var heapdump = require(‘heapdump’)

Method 1 : writeSnapshot

Method 2 : SIGUSR2 (Unix only)

Make sure your directory is writable

var heapdump = require('heapdump')...heapdump.writeSnapshot()

kill –USR2 <pid>

process.chdir('/path/to/writeable/dir’)

Page 11: Node.js dev ops

heapdump for V8 snapshots by @bnoordhuis

Programmatic heap snapshots (timer based)

Programmatic heap snapshots (threshold based)

var heapdump = require('heapdump') ... setInterval(function () {   heapdump.writeSnapshot() }, 6000 * 30) <strong>(1)</strong>

var heapdump = require('heapdump')var nextMBThreshold = 0 <strong>(1)</strong>

setInterval(function () {  var memMB = process.memoryUsage().rss / 1048576 <strong>(2)</strong>  if (memMB &gt; nextMBThreshold) { <strong>(3)</strong>    heapdump.writeSnapshot()    nextMBThreshold += 100  }}, 6000 * 2) <strong>(4)</strong>

Page 12: Node.js dev ops

12

Heapdump analysis in Chrome Dev Tools

Page 13: Node.js dev ops

13

Heapdump analysis in Chrome Dev Tools

Page 14: Node.js dev ops

Supervisor - Runtime

http://docs.strongloop.com/display/DOC/Strong+supervisor

usage: slc run [options] [app [app-options...]]usage: slr [options] [app [app-options...]]

Help, detach, version, log, pid, cluster, no-profile

Page 15: Node.js dev ops

Cluster Management and Control

http://docs.strongloop.com/display/DOC/Clustering+applications

slc clusterctl [options] [command]

Status, Set-size, Start, Stop, Restart, Fork, disconnect

Page 16: Node.js dev ops

DevOps Tools - Private Registry

Strong Registry

npm client

npm client

public npmjs

registry

Other upstream registries

metadata packag

es

indexes

• white/black list• audit

• security• cache

Pluggable Stores

① Private & multi-registry② On-premises, private or

public cloud support③ Module Whitelisting④ Audit⑤ Configuration Mgmt.⑥ CI and Build Mgmt.

Page 17: Node.js dev ops

Transaction and end-point tracing

Page 18: Node.js dev ops

Performance Monitoring

Page 19: Node.js dev ops

Performance Monitoring

Page 20: Node.js dev ops

Alerts

Page 21: Node.js dev ops

Open Data API