SlideShare a Scribd company logo
Shubhra Kar | Products & Education
twitter:@shubhrakar
{“Node.js”: “APIs @hyperscale”}
About me
u J2EE and SOA architect
u Performance architect
u Node, mBaaS & APIs
These guys sent me !
Bert
Belder
Ben
Noordhuis
Node/io core
Raymond
Feng
Ritchie
Martori
LoopBack & Express core
Sam
Roberts
Miroslav
Bajtos
Ryan
Graham
Buzzwords
Websites
Smart
Mobiles
Online
Catalog
Social
Media
Kiosks
Computers
Physical
Store
Gaming
Consoles
No IO bottlenecksHighly Concurrent
Very Fast JIT compiled
Node.js is emerging as the answer
Reduce infrastructure by 5XScalable
Lightweight, JS back and front, HeadlessFull stack
Write and maintain 50% lesser codeSimple
Suited for mobile and IoTEvented & JSON
Biggest OSS community on the planetEcosystem
Multi Threaded Server
Node.js Server
Integration needs to be lighter and isomorphic !
REST/JSON
X - Platform
Relational Database Clustered Database Security Gateway Cloud
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK API SE
Quick Example o
App Server
Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK API SERVER Items for ACL
Quick Example of Use
App Server
Add On
App Server
X - Backend
Legacy to front edge can be fast and simple !
Proof in the Pudding
0
500
1000
1500
2000
2500
3000
1000
 10000
Transactions/second
Back-end response (ms)
StrongLoop’s Node.js Solution vs. 5 leading competitive integration solutions 
Fortune 25 financial services customer evaluation in October 2014 "

leading competitor
closest competitor
Nodies are not just Silicon Valley hipsters !
Getting Started Tips
for
Converts
Ruby vs. Node
  RVM == NVM
–  Everything is kept neatly in your user home directory.
–  You can easily have multiple versions at the same time.
  GEM == NPM
–  $ npm install [PACKAGE NAME]
–  node_modules (global and local)
Gemfile == package.json
  bundle install == $ npm install
$response = file_get_contents("http://example.com");
print_r($response);
var http = require('http');
http.request({ hostname: 'example.com' }, function(res) {
res.setEncoding('utf8’);
res.on('data', function(chunk) {
console.log(chunk);
});
}).end();
Java vs. advanced node framework - Loopback
  https://strongloop.com/strongblog/node-js-java-getting-started/
  Beer REST API in Java on JBoss
–  Creating the pom.xml (LOC = 54)
–  Creating beans.xml and setting servlet mapping (LOC=10)
–  Creating DBConnection class (LOC = 35)
–  Importing data into MongoDB (LOC = 1)
–  Creating Beer model object (LOC = 24)
–  Creating the REST service (LOC = 48)
–  Bask in the Joy
Total LOC = 172, Server Install, Mongo Tools, etc…
Experience = sweaty
  Beer REST API in Node on Loopback
LOC = None (boilerplate scaffold), 10 config lines,
Experience = priceless
No I am serious
  JVM != V8
Bytecode = JIT compilation
  Package library = module
JaxRS = remoting
  EJB = microservice
  Controller = router
  Java Model Class = JSON Model
Big
Picture?
Evolution is inevitable !
Thick
Web
SaaS
Mobile IoT
Frameworks evolve as well !
•  Callback
•  Reactor
•  Observer
•  Express
•  HAPI
•  Restify
•  Total
•  Partial
•  Loopback
•  Parse
•  Meteor
•  Feedhenry*
•  Loopback
•  Sails
•  Meteor
•  Geddy
•  Loopback
•  NodeRED
•  Proprietary
KISS
MVC
MBaaS
ORM/
MEAN
Micro/
loT
Pattern 0: Natal patterns
Philosophy: KISS (Keep It Simple Stupid)
u small core
u small modules
u small surface area
Patterns
u reactor
u callback
u module
u observer
Pattern 1: Convention
HTTP Server Library REST HTTP Library
Simple MVC Structure
Pros and Cons
Express
DIY
HTTP Routing, Middleware, Templating
Simple Web Apps
Github Stars – 19K
Commercial Support - StrongLoop
CLI App Generator
Export API definition with strong-remoting
Connect/Express middleware extensions
Vast Ecosystem and low learning curve
StrongLoop DevOps tooling support
Manual CRUD endpoints
Manual recursive refactoring/testing
No Data source Support
No Client SDK
No ACL (Fine Authorization)
Restify
DIY
Simplicity, Rest Routing
Simple REST API
Github Stars – 3K
Commercial Support - Joyent
Yeoman Generator
SPDY Support
Dtrace Support
No export of API definition
No Data source Support
No Extensions of significance
Manual CRUD endpoints
Manual recursive refactoring/testing
Limited Ecosystem
No ACL (Fine Authorization)
Router
in
Express
StrongLoop	
  Confiden.al	
  and	
  Proprietary	
  Informa.on	
  –	
  ©	
  2015	
  
Router
in
Restify
StrongLoop	
  Confiden.al	
  and	
  Proprietary	
  Informa.on	
  –	
  ©	
  2015	
  
Pattern 2: Configuration
HTTP Server
Framework
Hapi
Opinionated
Modularity, Security, HTTP Server control
Complex Web Apps, APIs
Github Stars – 4K
Commercial Support - None
Yeoman Generator
No export of API definition
Hapi Plugins – Joi, bell, bassmaster, etc
Limited ecosystem as compared to Express;
but does support templates with plugins
Swagger support for API documentation
Very limited Data source support – Mongo,
Postgres, leveldb
No Client SDK
No ACL (Fine Authorization)
Router
in
hapi
StrongLoop	
  Confiden.al	
  and	
  Proprietary	
  Informa.on	
  –	
  ©	
  2015	
  
Pattern 3 : Full Stack JS à lends into pattern 4
{“..”} JSON is the new first class citizen
Pattern 4: ORM & Isomorphic JS
u Model Driven Development
u Any data source
u Isomorphic JS
u Omni-Channel
u Share Models (Client/Server)
u Loopback & Meteor
u Automatic REST API
generation, routing, etc
u Common Weakness : Higher
Learning Curve
Sails
Opinionated
Web MVC framework
WebApps, API
Rails familiarity, MVC
Github Stars – 10 K (older)
Commercial Support - None
Yeoman Generator
StrongLoop DevOps tooling support
No export of API definition
Limited data sources – MySQL, Mongo, Postgresql, memory/file
No Extensions of significance
Limited Ecosystem
No ACL (Fine Authorization)
No Client SDKs
Pros and Cons
Loopback
Opinionated
API framework
Complex Web Apps and APIs
Modularity, Scaffolding, Enterprise Connectivity
Github Stars – 4 K (newer)
Commercial Support - StrongLoop
CLI Code Generator, Visual API composer, API explorer
Export API definition
Extensions like Push, File Storage, Passport, Oauth 2.0, Express Middleware
Vast Connector ecosystem and extend express
Auto CRUD
Swagger UI and Code Generator
DataSources like Mongo, mySQL, Oracle, SOAP, REST, SQLServer, Memory/File,
Postgresql, Email, ATG, Couchbase, Apache Kafka, and many more
Client SDK – Angular, Browser, IOS, Android, Node.js
Mature ACL (Fine Authorization), API Gateway
Pros and Cons
ORM in Loopback.io
Sub-pattern : Schema Discovery
Isomorphic JS in Loopback.io
JS
client
JS
Server
Remoting
Router &
Swagger
in Loopback
StrongLoop	
  Confiden.al	
  and	
  Proprietary	
  Informa.on	
  –	
  ©	
  2015	
  
Router	
  using	
  Sails	
  
mobile/web
clients
social &
analytics
JSON API
API
XML
SQL
SOAP
Etc.
mBaaS
Mobile API tier
Enterprise	
  
Pattern 5: mBaaS
mBaaS could be on cloud or premises
u Closed Source / Commercial
u Open Source
Key API
u Push Notification
u Geo Location
u Offline Sync
u Storage
u User Management
u Metering, Analytics
u Native SDK
u Isomorphic JS
GeoLocation in Loopback.io
Push Notification in Loopback.io
Storage Service in Loopback.io
37
Wait …what is this API Gateway
thingy then ?
Synchronous API “Re-Composition” is an anti-pattern
Security & Social Logins
Why not an async API Gateway* ? Pattern 6
API Clients API Gateway API Server
API
*Releasing in a sprint !
Internet of Everything
The devices are taking over !!!
Microsecond latencies are the norm
API “Decomposition” is the game changer
{JSON}
{JSON}
{JSON}<SOAP/XML>
<TABLE>
Web SaaS Mobile loT
HTML JSON
App Server API Server
Pattern 7: Micro-services (Design Time)
Client SDK
REST
Endpoints
Store Cache
API Micro
Services
One URL Space
SL API PaaS REST/JSON
API Gateway
Router
Remoting
Model
API Orchestrator
Cloud Services
Model
Model
Connector
Connector
Connectors
Now I know !!!
StrongLoop – node.js Development to Production
Build and
Deploy
Automate
Lifecycle
Performance
Metrics
Real-time
production
monitoring
Profiler
Root cause
CPU & Memory
API Composer
Visual modeling
StrongLoop Arc
Process
Manager
Scale
applications"

Q2
2015
Mesh
Deploy 
containerized
ORM, mBaaS, Realtime
Loopback: Open Source nirvana (mBaaS, ORM, Micro)
REST
API
PUSH
GEO
OFF
SYNC
DEVICE
USER FILE
API
GATEWAY
Channel
SDKs
API ENGINE
C
O
N
N
E
C
T
O
R
s
atabase Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)
uested but useful)
nnections
Tablet Phone IoT SDK API SERVER Items for ACL
Quick Example of Use
App Server
Add On
App Server
ORM
ACLsRelational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK API SERVER Items for ACL
Quick Example of Use
App Server
Add On
App Server
Relational Database Clustered Database Security G
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK
App Server
Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK API SERVER Items for ACL
Quick Example of Use
App Server
Add On
App Server
Data and Services
Remoting
Pub-Sub
Data & Services Integration
Services
Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one)
Laptop ( not requested but useful)
Connections
Tablet Phone IoT SDK API SERVER Items for ACL
Quick Example of Use
App Server
Add On
App Server
Storage
y Cloud Firewall SOA Bus ( not sure on this one)
API SERVER Items for ACL
Quick Example of Use
App Server
Add On
REST
Messaging
Database
NoSQL
Marquee - Discovery & Migration !
Mobile Backend Services
Offline Sync
Geo Location
Push Notification
Storage
SDKs, Isomorphic JS, Offline Sync & Replication
JS
client
JS
Server
Remoting
JS
client Replication
Developer SDKs
Pub-Sub
JS
client
JS
Server
Remoting
JS
client Replication
HTTP
Proxy
Pub-Sub Repos
strong-pubsub (Client = require(‘strong-pubsub’))
strong-pubsub-proxy
strong-pubsub-mqtt
strong-pubsub-redis
strong-pubsub-connection-mqtt
strong-pubsub-primus (browser)
52
Pub-Sub architecture
53
API Explorer (Swagger) – Iterative build and test w/o frontend
Right interface for the right user
  Arc UI – architect view
–  Widget driven
–  Visual composition,
management & operations
–  Marquee featured, evolving
platform
  StrongLoop Console
(slc) - developer view
–  Command Line Interface
–  Full featured
–  Greater customization
support
Runtime Capabilities
Debugging
Debugging server side clustered apps
slc debug app.js
Debugging single process
slc debug app.js
http://localhost:8080/debug?port=<5858+ID-of-process>
Debugging clustered process in V11
%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
Debugging clustered process in V10
Memory Leaks ?
How does GC work
  Concept of reachability.
  Roots: Reachable or in live scope objects
  Include objects referenced from anywhere in the call stack (all local variables and
parameters in the functions currently being invoked), and any global variables.
  Objects are kept in memory while accessible from roots through a reference or a
chain of references.
  Root objects are pointed directly from V8 or the Web browser like DOM elements
  Garbage collector identifies dead memory regions/unreachable objects through a
chain of pointers from a live object; reallocates or releases them to the OS
Easy right ? Hell No !!!
Pause and then Stop the World
V8 essentially:
  stops program execution when
performing a garbage collection cycle.
  processes only part of the object heap
in most garbage collection cycles. This
minimizes the impact of stopping the
application.
  Accurately keeps all objects and
pointers in memory. This avoids falsely
identifying objects as pointers which
can result in memory leaks.
  In V8, the object heap is segmented
into many parts; hence If an object is
moved in a garbage collection cycle,
V8 updates all pointers to the object.
Short, Full GC and some algorithms to know
V8 divides the heap into two generations:
Short GC/scavenging
Objects are allocated in “new-space” (between 1 and 8 MB). Allocation in new space is
very cheap; increment an allocation pointer when we want to reserve space for a new
object. When the pointer reaches the end of new space, a scavenge (minor garbage
collection cycle) is triggered, quickly removing dead objects from new space.
  large space overhead, since we need physical memory backing both to-space and from-
space.
  Fast by design, hence using for short GC cycles. Acceptable if new space is small – a few
Mbs
Full GC/mark-sweep & mark-compact
Objects which have survived two minor garbage collections are promoted to “old-space.”
Old-space is garbage collected in full GC (major garbage collection cycle), which is much
less frequent.
A full GC cycle is triggered based on a memory threshold
  To collect old space, which may contain several hundred megabytes of data, we use two
closely related algorithms, Mark-sweep and Mark-compact.
New Algorithm implementation
Incremental marking & lazy sweeping
  In mid-2012, Google introduced two improvements that reduced garbage
collection pauses significantly: incremental marking and lazy sweeping.
  Incremental marking means being able to do a bit of marking work, then let the
mutator (JavaScript program) run a bit, then do another bit of marking work.
  Short pauses in the order of 5-10 ms each as an example for marking.
  Threshold based. At every alloc execution is paused to perform an incremental
marking step.
  Lazy sweep cleans up set of objects at time eventually cleaning all pages.
Analyze, Analyze, Analyze
heapdump for V8 snapshots by StrongLoop
npm install heapdump
  Add 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’)
heapdump for V8 snapshots by StrongLoop
  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>
Simpler – slc arc and remote profiling
CPUs smoke too !
CPU profiler : slc cpu-start/stop or just slc arc
How we fixed a real production
problem
Performance 1 on 1: Don’t Block the EventLoop
Blocked event loop in Meteor Atmosphere
  node-fibers implements co-routines. Meteor uses this to hack local thread storage allowing V8
to run multiple execution contexts each mapped to a co-routine.
FindOrAllocatePerThreadDataForThisThread() used in switching context between co-
routines
  Co-routines are cooperative; the current coroutine has to yield control before another one can
run and that is what Meteor does in its process.nextTick() callback; it essentially builds
concurrent (but not parallel) green threads on a round-robin scheduler
  Too many tiny tasks and not one long running one was blocking the event loop
process.nextTick() has a failsafe mechanism where it will process “x” tick callbacks before
deferring the remaining ones to the next event loop tick.
  Native MongoDB driver disabled the failsafe to silence a warning message in node v0.10 about
maxtickDepth being reached
ticks parent name
2274 7.3% v8::internal::Isolate::FindOrAllocatePerThreadDataForThisThread()
1325 58.3% LazyCompile: ~<anonymous> packages/meteor.js:683
1325 100.0% LazyCompile: _tickCallback node.js:399
The solution
  The workaround: switch fromprocess.nextTick() to setImmediate()
Deep Transaction Tracing
Real time Production Monitoring
3rd Party Metrics integration
•  Arc
•  Graphite
•  Splunk
•  Datadog
•  CA APM
•  Sumologic
Build & Deploy
Horizontal and Vertical Scaling with Process Manager
Micro services scaling
Hyper-scale & Micro-services Deployment
First there was Node
Thank you!
JUST WIN,
BABY!

More Related Content

What's hot

LoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEANLoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEAN
Miroslav Bajtoš
 
StrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & CustomizationStrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & Customization
jguerrero999
 
Loopback presentation by tineco
Loopback presentation by tinecoLoopback presentation by tineco
Loopback presentation by tineco
Stéphane Guilly
 
Building Mobile Apps With Ionic & Loopback
Building Mobile Apps With Ionic & LoopbackBuilding Mobile Apps With Ionic & Loopback
Building Mobile Apps With Ionic & Loopback
Chibuzor Obiora
 
Making your API behave like a big boy
Making your API behave like a big boyMaking your API behave like a big boy
Making your API behave like a big boy
Andrew Siemer
 
Intro to Azure Static Web Apps
Intro to Azure Static Web AppsIntro to Azure Static Web Apps
Intro to Azure Static Web Apps
Moaid Hathot
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code
3scale
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and more
Mitoc Group
 
Ben Kehoe - Serverless Architecture for the Internet of Things
Ben Kehoe - Serverless Architecture for the Internet of ThingsBen Kehoe - Serverless Architecture for the Internet of Things
Ben Kehoe - Serverless Architecture for the Internet of Things
ServerlessConf
 
Scaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the ChallengesScaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the Challenges
Apigee | Google Cloud
 
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Amazon Web Services
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
Tony Tam
 
Serverless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about serversServerless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about servers
Amazon Web Services
 
AWS API Gateway - AJUG August 2018
AWS API Gateway - AJUG August 2018AWS API Gateway - AJUG August 2018
AWS API Gateway - AJUG August 2018
Yoel Spotts
 
Another API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger ComparisonAnother API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger Comparison
SmartBear
 
Mobile APIs: Optimizing APIs for Many Devices
Mobile APIs: Optimizing APIs for Many DevicesMobile APIs: Optimizing APIs for Many Devices
Mobile APIs: Optimizing APIs for Many Devices
Apigee | Google Cloud
 
Building a Critical Communications Platform Using Serverless Technologies
Building a Critical Communications Platform Using Serverless TechnologiesBuilding a Critical Communications Platform Using Serverless Technologies
Building a Critical Communications Platform Using Serverless Technologies
Amazon Web Services
 
Azure Web Apps - Introduction
Azure Web Apps - IntroductionAzure Web Apps - Introduction
Azure Web Apps - Introduction
Christopher Gomez
 
Simple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and SwaggerSimple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and Swagger
LeanIX GmbH
 
Full Stack Developer
Full Stack DeveloperFull Stack Developer
Full Stack Developer
Akbar Uddin
 

What's hot (20)

LoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEANLoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEAN
 
StrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & CustomizationStrongLoop Node.js API Security & Customization
StrongLoop Node.js API Security & Customization
 
Loopback presentation by tineco
Loopback presentation by tinecoLoopback presentation by tineco
Loopback presentation by tineco
 
Building Mobile Apps With Ionic & Loopback
Building Mobile Apps With Ionic & LoopbackBuilding Mobile Apps With Ionic & Loopback
Building Mobile Apps With Ionic & Loopback
 
Making your API behave like a big boy
Making your API behave like a big boyMaking your API behave like a big boy
Making your API behave like a big boy
 
Intro to Azure Static Web Apps
Intro to Azure Static Web AppsIntro to Azure Static Web Apps
Intro to Azure Static Web Apps
 
Five Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your CodeFive Ways to Scale your API Without Touching Your Code
Five Ways to Scale your API Without Touching Your Code
 
Microservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and moreMicroservices Architecture for Web Applications using AWS Lambda and more
Microservices Architecture for Web Applications using AWS Lambda and more
 
Ben Kehoe - Serverless Architecture for the Internet of Things
Ben Kehoe - Serverless Architecture for the Internet of ThingsBen Kehoe - Serverless Architecture for the Internet of Things
Ben Kehoe - Serverless Architecture for the Internet of Things
 
Scaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the ChallengesScaling APIs: Predict, Prepare for, Overcome the Challenges
Scaling APIs: Predict, Prepare for, Overcome the Challenges
 
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
Building API-Driven Microservices with Amazon API Gateway - AWS Online Tech T...
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
Serverless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about serversServerless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about servers
 
AWS API Gateway - AJUG August 2018
AWS API Gateway - AJUG August 2018AWS API Gateway - AJUG August 2018
AWS API Gateway - AJUG August 2018
 
Another API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger ComparisonAnother API-Blueprint, RAML and Swagger Comparison
Another API-Blueprint, RAML and Swagger Comparison
 
Mobile APIs: Optimizing APIs for Many Devices
Mobile APIs: Optimizing APIs for Many DevicesMobile APIs: Optimizing APIs for Many Devices
Mobile APIs: Optimizing APIs for Many Devices
 
Building a Critical Communications Platform Using Serverless Technologies
Building a Critical Communications Platform Using Serverless TechnologiesBuilding a Critical Communications Platform Using Serverless Technologies
Building a Critical Communications Platform Using Serverless Technologies
 
Azure Web Apps - Introduction
Azure Web Apps - IntroductionAzure Web Apps - Introduction
Azure Web Apps - Introduction
 
Simple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and SwaggerSimple REST-APIs with Dropwizard and Swagger
Simple REST-APIs with Dropwizard and Swagger
 
Full Stack Developer
Full Stack DeveloperFull Stack Developer
Full Stack Developer
 

Similar to Seattle StrongLoop Node.js Workshop

Node.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns WebinarNode.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns Webinar
Shubhra Kar
 
Ibm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshopIbm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshop
Shubhra Kar
 
Triangle Node Meetup : APIs in Minutes with Node.js
Triangle Node Meetup :  APIs in Minutes with Node.jsTriangle Node Meetup :  APIs in Minutes with Node.js
Triangle Node Meetup : APIs in Minutes with Node.js
Shubhra Kar
 
Toronto node js_meetup
Toronto node js_meetupToronto node js_meetup
Toronto node js_meetup
Shubhra Kar
 
Cloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersCloud State of the Union for Java Developers
Cloud State of the Union for Java Developers
Burr Sutter
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
Shubhra Kar
 
Node summit workshop
Node summit workshopNode summit workshop
Node summit workshop
Shubhra Kar
 
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
François-Guillaume Ribreau
 
Mashups
MashupsMashups
Mashups
Johan Eltes
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devs
guest0a62e8
 
Spring Boot & Spring Cloud on Pivotal Application Service
Spring Boot & Spring Cloud on Pivotal Application ServiceSpring Boot & Spring Cloud on Pivotal Application Service
Spring Boot & Spring Cloud on Pivotal Application Service
VMware Tanzu
 
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel LavoieSpring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
VMware Tanzu
 
Ramji
RamjiRamji
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
Adnan Masood
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Amazon Web Services
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
John Schneider
 
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
Pivoting Spring XD to Spring Cloud Data Flow with Sabby AnandanPivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
PivotalOpenSourceHub
 
Nasdanika Foundation Server
Nasdanika Foundation ServerNasdanika Foundation Server
Nasdanika Foundation Server
Pavel Vlasov
 
Service Testing. WTF Does This API Do
Service Testing. WTF Does This API Do	Service Testing. WTF Does This API Do
Service Testing. WTF Does This API Do
Globant
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
Sascha Wenninger
 

Similar to Seattle StrongLoop Node.js Workshop (20)

Node.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns WebinarNode.js Frameworks & Design Patterns Webinar
Node.js Frameworks & Design Patterns Webinar
 
Ibm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshopIbm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshop
 
Triangle Node Meetup : APIs in Minutes with Node.js
Triangle Node Meetup :  APIs in Minutes with Node.jsTriangle Node Meetup :  APIs in Minutes with Node.js
Triangle Node Meetup : APIs in Minutes with Node.js
 
Toronto node js_meetup
Toronto node js_meetupToronto node js_meetup
Toronto node js_meetup
 
Cloud State of the Union for Java Developers
Cloud State of the Union for Java DevelopersCloud State of the Union for Java Developers
Cloud State of the Union for Java Developers
 
Connect js nodejs_api_shubhra
Connect js nodejs_api_shubhraConnect js nodejs_api_shubhra
Connect js nodejs_api_shubhra
 
Node summit workshop
Node summit workshopNode summit workshop
Node summit workshop
 
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
 
Mashups
MashupsMashups
Mashups
 
A Microsoft primer for PHP devs
A Microsoft primer for PHP devsA Microsoft primer for PHP devs
A Microsoft primer for PHP devs
 
Spring Boot & Spring Cloud on Pivotal Application Service
Spring Boot & Spring Cloud on Pivotal Application ServiceSpring Boot & Spring Cloud on Pivotal Application Service
Spring Boot & Spring Cloud on Pivotal Application Service
 
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel LavoieSpring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
Spring Boot & Spring Cloud Apps on Pivotal Application Service - Daniel Lavoie
 
Ramji
RamjiRamji
Ramji
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
Pivoting Spring XD to Spring Cloud Data Flow with Sabby AnandanPivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
 
Nasdanika Foundation Server
Nasdanika Foundation ServerNasdanika Foundation Server
Nasdanika Foundation Server
 
Service Testing. WTF Does This API Do
Service Testing. WTF Does This API Do	Service Testing. WTF Does This API Do
Service Testing. WTF Does This API Do
 
REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)REST - What's It All About? (SAP TechEd 2012, CD110)
REST - What's It All About? (SAP TechEd 2012, CD110)
 

Recently uploaded

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
SOCRadar
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 

Recently uploaded (20)

socradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdfsocradar-q1-2024-aviation-industry-report.pdf
socradar-q1-2024-aviation-industry-report.pdf
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 

Seattle StrongLoop Node.js Workshop

  • 1. Shubhra Kar | Products & Education twitter:@shubhrakar {“Node.js”: “APIs @hyperscale”}
  • 2. About me u J2EE and SOA architect u Performance architect u Node, mBaaS & APIs
  • 3. These guys sent me ! Bert Belder Ben Noordhuis Node/io core Raymond Feng Ritchie Martori LoopBack & Express core Sam Roberts Miroslav Bajtos Ryan Graham
  • 5. No IO bottlenecksHighly Concurrent Very Fast JIT compiled Node.js is emerging as the answer Reduce infrastructure by 5XScalable Lightweight, JS back and front, HeadlessFull stack Write and maintain 50% lesser codeSimple Suited for mobile and IoTEvented & JSON Biggest OSS community on the planetEcosystem
  • 7. Integration needs to be lighter and isomorphic ! REST/JSON X - Platform Relational Database Clustered Database Security Gateway Cloud Laptop ( not requested but useful) Connections Tablet Phone IoT SDK API SE Quick Example o App Server Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one) Laptop ( not requested but useful) Connections Tablet Phone IoT SDK API SERVER Items for ACL Quick Example of Use App Server Add On App Server X - Backend Legacy to front edge can be fast and simple !
  • 8. Proof in the Pudding 0 500 1000 1500 2000 2500 3000 1000 10000 Transactions/second Back-end response (ms) StrongLoop’s Node.js Solution vs. 5 leading competitive integration solutions Fortune 25 financial services customer evaluation in October 2014 " leading competitor closest competitor
  • 9. Nodies are not just Silicon Valley hipsters !
  • 11. Ruby vs. Node   RVM == NVM –  Everything is kept neatly in your user home directory. –  You can easily have multiple versions at the same time.   GEM == NPM –  $ npm install [PACKAGE NAME] –  node_modules (global and local) Gemfile == package.json   bundle install == $ npm install $response = file_get_contents("http://example.com"); print_r($response); var http = require('http'); http.request({ hostname: 'example.com' }, function(res) { res.setEncoding('utf8’); res.on('data', function(chunk) { console.log(chunk); }); }).end();
  • 12. Java vs. advanced node framework - Loopback   https://strongloop.com/strongblog/node-js-java-getting-started/   Beer REST API in Java on JBoss –  Creating the pom.xml (LOC = 54) –  Creating beans.xml and setting servlet mapping (LOC=10) –  Creating DBConnection class (LOC = 35) –  Importing data into MongoDB (LOC = 1) –  Creating Beer model object (LOC = 24) –  Creating the REST service (LOC = 48) –  Bask in the Joy Total LOC = 172, Server Install, Mongo Tools, etc… Experience = sweaty   Beer REST API in Node on Loopback LOC = None (boilerplate scaffold), 10 config lines, Experience = priceless
  • 13. No I am serious   JVM != V8 Bytecode = JIT compilation   Package library = module JaxRS = remoting   EJB = microservice   Controller = router   Java Model Class = JSON Model
  • 15. Evolution is inevitable ! Thick Web SaaS Mobile IoT
  • 16. Frameworks evolve as well ! •  Callback •  Reactor •  Observer •  Express •  HAPI •  Restify •  Total •  Partial •  Loopback •  Parse •  Meteor •  Feedhenry* •  Loopback •  Sails •  Meteor •  Geddy •  Loopback •  NodeRED •  Proprietary KISS MVC MBaaS ORM/ MEAN Micro/ loT
  • 17. Pattern 0: Natal patterns Philosophy: KISS (Keep It Simple Stupid) u small core u small modules u small surface area Patterns u reactor u callback u module u observer
  • 18. Pattern 1: Convention HTTP Server Library REST HTTP Library Simple MVC Structure
  • 19. Pros and Cons Express DIY HTTP Routing, Middleware, Templating Simple Web Apps Github Stars – 19K Commercial Support - StrongLoop CLI App Generator Export API definition with strong-remoting Connect/Express middleware extensions Vast Ecosystem and low learning curve StrongLoop DevOps tooling support Manual CRUD endpoints Manual recursive refactoring/testing No Data source Support No Client SDK No ACL (Fine Authorization) Restify DIY Simplicity, Rest Routing Simple REST API Github Stars – 3K Commercial Support - Joyent Yeoman Generator SPDY Support Dtrace Support No export of API definition No Data source Support No Extensions of significance Manual CRUD endpoints Manual recursive refactoring/testing Limited Ecosystem No ACL (Fine Authorization)
  • 20. Router in Express StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  
  • 21. Router in Restify StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  
  • 22. Pattern 2: Configuration HTTP Server Framework Hapi Opinionated Modularity, Security, HTTP Server control Complex Web Apps, APIs Github Stars – 4K Commercial Support - None Yeoman Generator No export of API definition Hapi Plugins – Joi, bell, bassmaster, etc Limited ecosystem as compared to Express; but does support templates with plugins Swagger support for API documentation Very limited Data source support – Mongo, Postgres, leveldb No Client SDK No ACL (Fine Authorization)
  • 23. Router in hapi StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  
  • 24. Pattern 3 : Full Stack JS à lends into pattern 4 {“..”} JSON is the new first class citizen
  • 25. Pattern 4: ORM & Isomorphic JS u Model Driven Development u Any data source u Isomorphic JS u Omni-Channel u Share Models (Client/Server) u Loopback & Meteor u Automatic REST API generation, routing, etc u Common Weakness : Higher Learning Curve
  • 26. Sails Opinionated Web MVC framework WebApps, API Rails familiarity, MVC Github Stars – 10 K (older) Commercial Support - None Yeoman Generator StrongLoop DevOps tooling support No export of API definition Limited data sources – MySQL, Mongo, Postgresql, memory/file No Extensions of significance Limited Ecosystem No ACL (Fine Authorization) No Client SDKs Pros and Cons
  • 27. Loopback Opinionated API framework Complex Web Apps and APIs Modularity, Scaffolding, Enterprise Connectivity Github Stars – 4 K (newer) Commercial Support - StrongLoop CLI Code Generator, Visual API composer, API explorer Export API definition Extensions like Push, File Storage, Passport, Oauth 2.0, Express Middleware Vast Connector ecosystem and extend express Auto CRUD Swagger UI and Code Generator DataSources like Mongo, mySQL, Oracle, SOAP, REST, SQLServer, Memory/File, Postgresql, Email, ATG, Couchbase, Apache Kafka, and many more Client SDK – Angular, Browser, IOS, Android, Node.js Mature ACL (Fine Authorization), API Gateway Pros and Cons
  • 29. Sub-pattern : Schema Discovery
  • 30. Isomorphic JS in Loopback.io JS client JS Server Remoting
  • 31. Router & Swagger in Loopback StrongLoop  Confiden.al  and  Proprietary  Informa.on  –  ©  2015  
  • 34. mBaaS could be on cloud or premises u Closed Source / Commercial u Open Source Key API u Push Notification u Geo Location u Offline Sync u Storage u User Management u Metering, Analytics u Native SDK u Isomorphic JS
  • 36. Push Notification in Loopback.io
  • 37. Storage Service in Loopback.io 37
  • 38. Wait …what is this API Gateway thingy then ?
  • 40. Security & Social Logins Why not an async API Gateway* ? Pattern 6 API Clients API Gateway API Server API *Releasing in a sprint !
  • 41. Internet of Everything The devices are taking over !!! Microsecond latencies are the norm
  • 42. API “Decomposition” is the game changer {JSON} {JSON} {JSON}<SOAP/XML> <TABLE> Web SaaS Mobile loT HTML JSON App Server API Server
  • 43. Pattern 7: Micro-services (Design Time) Client SDK REST Endpoints Store Cache API Micro Services One URL Space SL API PaaS REST/JSON API Gateway Router Remoting Model API Orchestrator Cloud Services Model Model Connector Connector Connectors
  • 44. Now I know !!!
  • 45. StrongLoop – node.js Development to Production Build and Deploy Automate Lifecycle Performance Metrics Real-time production monitoring Profiler Root cause CPU & Memory API Composer Visual modeling StrongLoop Arc Process Manager Scale applications" Q2 2015 Mesh Deploy containerized ORM, mBaaS, Realtime
  • 46.
  • 47. Loopback: Open Source nirvana (mBaaS, ORM, Micro) REST API PUSH GEO OFF SYNC DEVICE USER FILE API GATEWAY Channel SDKs API ENGINE C O N N E C T O R s atabase Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one) uested but useful) nnections Tablet Phone IoT SDK API SERVER Items for ACL Quick Example of Use App Server Add On App Server ORM ACLsRelational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one) Laptop ( not requested but useful) Connections Tablet Phone IoT SDK API SERVER Items for ACL Quick Example of Use App Server Add On App Server Relational Database Clustered Database Security G Laptop ( not requested but useful) Connections Tablet Phone IoT SDK App Server Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one) Laptop ( not requested but useful) Connections Tablet Phone IoT SDK API SERVER Items for ACL Quick Example of Use App Server Add On App Server Data and Services Remoting Pub-Sub
  • 48. Data & Services Integration Services Relational Database Clustered Database Security Gateway Cloud Firewall SOA Bus ( not sure on this one) Laptop ( not requested but useful) Connections Tablet Phone IoT SDK API SERVER Items for ACL Quick Example of Use App Server Add On App Server Storage y Cloud Firewall SOA Bus ( not sure on this one) API SERVER Items for ACL Quick Example of Use App Server Add On REST Messaging Database NoSQL Marquee - Discovery & Migration !
  • 49. Mobile Backend Services Offline Sync Geo Location Push Notification Storage
  • 50. SDKs, Isomorphic JS, Offline Sync & Replication JS client JS Server Remoting JS client Replication Developer SDKs
  • 52. Pub-Sub Repos strong-pubsub (Client = require(‘strong-pubsub’)) strong-pubsub-proxy strong-pubsub-mqtt strong-pubsub-redis strong-pubsub-connection-mqtt strong-pubsub-primus (browser) 52
  • 54. API Explorer (Swagger) – Iterative build and test w/o frontend
  • 55. Right interface for the right user   Arc UI – architect view –  Widget driven –  Visual composition, management & operations –  Marquee featured, evolving platform   StrongLoop Console (slc) - developer view –  Command Line Interface –  Full featured –  Greater customization support
  • 58. Debugging server side clustered apps slc debug app.js Debugging single process slc debug app.js http://localhost:8080/debug?port=<5858+ID-of-process> Debugging clustered process in V11 %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 Debugging clustered process in V10
  • 60. How does GC work   Concept of reachability.   Roots: Reachable or in live scope objects   Include objects referenced from anywhere in the call stack (all local variables and parameters in the functions currently being invoked), and any global variables.   Objects are kept in memory while accessible from roots through a reference or a chain of references.   Root objects are pointed directly from V8 or the Web browser like DOM elements   Garbage collector identifies dead memory regions/unreachable objects through a chain of pointers from a live object; reallocates or releases them to the OS
  • 61. Easy right ? Hell No !!! Pause and then Stop the World V8 essentially:   stops program execution when performing a garbage collection cycle.   processes only part of the object heap in most garbage collection cycles. This minimizes the impact of stopping the application.   Accurately keeps all objects and pointers in memory. This avoids falsely identifying objects as pointers which can result in memory leaks.   In V8, the object heap is segmented into many parts; hence If an object is moved in a garbage collection cycle, V8 updates all pointers to the object.
  • 62. Short, Full GC and some algorithms to know V8 divides the heap into two generations: Short GC/scavenging Objects are allocated in “new-space” (between 1 and 8 MB). Allocation in new space is very cheap; increment an allocation pointer when we want to reserve space for a new object. When the pointer reaches the end of new space, a scavenge (minor garbage collection cycle) is triggered, quickly removing dead objects from new space.   large space overhead, since we need physical memory backing both to-space and from- space.   Fast by design, hence using for short GC cycles. Acceptable if new space is small – a few Mbs Full GC/mark-sweep & mark-compact Objects which have survived two minor garbage collections are promoted to “old-space.” Old-space is garbage collected in full GC (major garbage collection cycle), which is much less frequent. A full GC cycle is triggered based on a memory threshold   To collect old space, which may contain several hundred megabytes of data, we use two closely related algorithms, Mark-sweep and Mark-compact.
  • 63. New Algorithm implementation Incremental marking & lazy sweeping   In mid-2012, Google introduced two improvements that reduced garbage collection pauses significantly: incremental marking and lazy sweeping.   Incremental marking means being able to do a bit of marking work, then let the mutator (JavaScript program) run a bit, then do another bit of marking work.   Short pauses in the order of 5-10 ms each as an example for marking.   Threshold based. At every alloc execution is paused to perform an incremental marking step.   Lazy sweep cleans up set of objects at time eventually cleaning all pages.
  • 65. heapdump for V8 snapshots by StrongLoop npm install heapdump   Add 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’)
  • 66. heapdump for V8 snapshots by StrongLoop   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>
  • 67. Simpler – slc arc and remote profiling
  • 69. CPU profiler : slc cpu-start/stop or just slc arc
  • 70. How we fixed a real production problem
  • 71. Performance 1 on 1: Don’t Block the EventLoop
  • 72. Blocked event loop in Meteor Atmosphere   node-fibers implements co-routines. Meteor uses this to hack local thread storage allowing V8 to run multiple execution contexts each mapped to a co-routine. FindOrAllocatePerThreadDataForThisThread() used in switching context between co- routines   Co-routines are cooperative; the current coroutine has to yield control before another one can run and that is what Meteor does in its process.nextTick() callback; it essentially builds concurrent (but not parallel) green threads on a round-robin scheduler   Too many tiny tasks and not one long running one was blocking the event loop process.nextTick() has a failsafe mechanism where it will process “x” tick callbacks before deferring the remaining ones to the next event loop tick.   Native MongoDB driver disabled the failsafe to silence a warning message in node v0.10 about maxtickDepth being reached ticks parent name 2274 7.3% v8::internal::Isolate::FindOrAllocatePerThreadDataForThisThread() 1325 58.3% LazyCompile: ~<anonymous> packages/meteor.js:683 1325 100.0% LazyCompile: _tickCallback node.js:399
  • 73. The solution   The workaround: switch fromprocess.nextTick() to setImmediate()
  • 75. Real time Production Monitoring
  • 76. 3rd Party Metrics integration •  Arc •  Graphite •  Splunk •  Datadog •  CA APM •  Sumologic
  • 78. Horizontal and Vertical Scaling with Process Manager
  • 81. First there was Node Thank you! JUST WIN, BABY!