A295 nodejs-knowledge-accelerator
Click here to load reader
-
Upload
michael-dawson -
Category
Technology
-
view
250 -
download
0
Transcript of A295 nodejs-knowledge-accelerator
A295
Node.js – Knowledge Accelerator
Michael Dawson, IBM Runtime Technologies
© 2016 IBM Corporation 2
About Michael Dawson
Senior Software Developer @ IBMIBM Runtime Technologies Node.js Technical Lead
Node.js collaborator and CTC member
Active in LTS, build, benchmarking , api
and post-mortem working groups
Contact me:
[email protected]: @mhdawson1
https://www.linkedin.com/in/michael-dawson-6051282
© 2016 IBM Corporation 3
Agenda
• Why Node.js ?
• Node.js deep dive
• Positioning versus Java
• Node.js community
• IBM involvement
TM
© 2016 IBM Corporation
• What is it ?
• Ecosystem
• Productivity
• Performance
Why Node.js ?
4
© 2016 IBM Corporation 5
Why Node.js –What is it?
• JavaScript != Java
• Node.js = Server-side JavaScript
• Event-oriented
• Non-blocking
• Asynchronous
http://www.modulecounts.com/
© 2016 IBM Corporation
• There is a module for that• 300K modules
• #1 on module counts
• #1 on Github (#projects)
• #1 on StackOverflow(2015)
Why Node.js ? – Ecosystem
6
© 2016 IBM Corporation
• Most used runtime in
Bluemix
TM
Why Node.js ? – Ecosystem
7
Why Node.js ? – Productivity
© 2016 IBM Corporation
• Faster development less code
• PayPal - https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/
• Took 1/2 time with less people
• 33% fewer lines of code
• NextFlix - http://www.infoworld.com/article/2610110/javascript/paypal-and-netflix-cozy-up-
to-node-js.html
8
Why Node.js ? – Productivity
© 2016 IBM Corporation
• Reuse of “isomorphic” code components
• Availability of JavaScript talent
• Developer satisfaction
9
Why Node.js ? – Productivity
© 2016 IBM Corporation 10
Why Node.js ? – Performance
© 2016 IBM Corporation
Event based: perfect fit for asynchronous non-blocking I/0
11
Why Node.js ? – Performance
© 2016 IBM Corporation
Best suited for asynchronous workloads
-80
-60
-40
-20
0
20
40
-75 -60.5 -18
28
JSON Serialization
Single Query
Multiple Queries
Data Updates
%a
ge
of Ja
va P
erf
orm
ance
More
Computation
More
I/O
12
Why Node.js ? - Performance
© 2016 IBM Corporation
• Thousands of concurrent connections
• PayPal - https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/
• Double number of requests/sec
• Response times 35% lower
• Groupon – http://www.nearform.com/nodecrunch/node-js-becoming-go-technology-enterprise/
• Reduced page load times by 50%
13
© 2016 IBM Corporation 14
• Key characteristics
• Components
• Programing model
• Event loop
• Native code
• Common use cases
Node.js – Deep Dive
© 2016 IBM Corporation 15
• Small (linux.tar.xz)• Download 8.2MB
• Uncompressed 35.5 MB
• Fast startup• 40 ms
• Small footprint• 16.5 MB
Node.js – Deep Dive – Key Characteristics
https://nodejs.org/en/download/
https://benchmarking.nodejs.org/
Node.js – Deep Dive - Components
© 2016 IBM Corporation
V8 – JavascriptEngine
V8 JavaScript Engine Libuv
Other DependenciesICUCaresZlibhttp_parser
…
Node Binding Layer
Operating System
Node Libraries
Modules (npm or local) + Application
Op
en
SS
L
16
Node.js – Deep Dive - Programing Model
© 2016 IBM Corporation
• Dynamic
• Functional
• Asynchronous
• Event Based
17
© 2016 IBM Corporation 18
Node.js – Deep Dive - Programming Model
var http = require('http');
var server = http.createServer();
server.listen(8080);
server.on('request', function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World!\n");
response.end();
});
server.on('connection', function(socket) {});
server.on('close', function() {});
server.on('connect', function(socket) {});
server.on('upgrade', function(request, socket, head) {});
server.on('clientError', function(exception, socket) {});
• Event Based
Node.js – Deep Dive – Event Loop
19© 2016 IBM Corporation
Node.js – Deep Dive – Native Code
© 2016 IBM Corporation
https://nodejs.org/api/addons.html
#include <node.h>
void nativeMethod(const FunctionCallbackInfo<Value> & args) {
Isolate* is = args.GetIsolate();
args.GetReturnValue().Set(String::NewFromUtf8(is, “Hi from native”));
}
void init(Local<Object> exports) {
NODE_SET_METHOD(exports, “callNative”, nativeMethod);
}
NODE_MODULE(nativeModule, init);
20
Node.js – Deep Dive – Native Code
© 2016 IBM Corporation
https://nodejs.org/api/addons.html
const nativeModule = require(‘./build/Release/nativeModule’);
console.log(nativeModule.callNative());
21
© 2016 IBM Corporation 22
• Back-end API services• Service oriented architectures (SOA)• Microservice-based applications• Generating/serving dynamic web page content• SPA applications with bidirectional communication over
WebSockets and/or HTTP/2• Agents and data collectors• Small scripts
Node.js – Deep Dive – Use Cases
https://github.com/nodejs/benchmarking/blob/master/docs/use_cases.md
© 2016 IBM Corporation 23
• Strengths and weaknesses
• Choosing the right language
• Hybrid applications
Node.js versus Java
© 2016 IBM Corporation 24
• One thread (or process) per connection
• Each thread waits on a response
• Scalability determined by number of threads
• Each thread:
• Consumes memory
• Is relatively idle
• Concurrency determined by number of
depot workers
Node.js versus Java – Scaling with Java
© 2016 IBM Corporation 25
• One thread multiplexes for multiple requests
• No waiting for a response
• Handles return from I/O when notified
• Scalability determined by:
• CPU Usage
• “Back end” responsiveness
• Concurrency determined by how fast the
food server can work
Node.js versus Java – Scaling with Node.js
Node.js versus Node.js – Tradeoff
© 2016 IBM Corporation
-80
-60
-40
-20
0
20
40
-75 -60.5 -18
28
JSON Serialization
Single Query
Multiple Queries
Data Updates
%a
ge
of Ja
va P
erf
orm
ance
More
Computation
More
I/O
26
© 2016 IBM Corporation 27
• Higher performance for I/O
• Easier async programming
• Fullstack/isomorphic development
Node.js versus Java – Choosing the Right Language
© 2016 IBM Corporation 28
Node.js versus Java – Choosing the Right Language
• Higher processing performance
• Type safety for calculations
• Rich processing frameworks
© 2016 IBM Corporation 29
• Highly performant, scalable rich web applications
• Highly performant, reliable transaction processing
• Self-contained micro-service components
Node.js versus Java – Choosing the Right Language
+
Node.js versus Node.js – Hybrid applications
© 2016 IBM Corporation 30
© 2016 IBM Corporation 31
• History
• Foundation
• Day to Day
Node.js Community
© 2016 IBM Corporation 32
• 2009 – written by Ryan Dhal
• Jan 2010 - npm
• Sep 2010 – Joyent sponsors Node.js
• June 2011 – Windows support
• 2012 – 2014 – Hand over to Isaac Schlueter, then Timothy J. Fontaine
• December 2014 – io.js fork
• June 2015 – Node.js Foundation
• Oct 2015 – Node.js 4.x unites io.js/node.js 0.12.x lines
• Oct 2016 – Node.js 6.x
Node.js Community - History
© 2016 IBM Corporation 33
• Mission:
• Corporate members
• 8 platinum(including IBM), 19 Silver
• Individual members
Node.js Community - Foundation
https://nodejs.org/en/foundation/
The Node.js Foundation's mission is to enable widespread adoption and help accelerate development of Node.js and other related modules through an open governance model that encourages participation, technical contribution, and a framework for long term stewardship by an ecosystem invested in Node.js' success.
© 2016 IBM Corporation 34
• TSC - Technical Steering Committee
• CTC – Core technical Committee
• Collaborators (~76)
• Working Groups (Build, LTS, Benchmarking, API etc.)
• Teams
Node.js Community – Day to Day
https://github.com/nodejs/TSC/
https://github.com/nodejs/node/
https://github.com/nodejs/node/blob/master/WORKING_GROUPS.md
https://github.com/orgs/nodejs/teams
© 2016 IBM Corporation 35
• Development Model
• Node.js Community Involvement
• V8 Community Involvement
• Platform Availability
• Tooling
Node.js - IBM
© 2016 IBM Corporation 36
• Leverage Open Source
• Develop in community
• Add support for IBM platforms
• Support internal teams and our customers
Node.js IBM – Development Model
© 2016 IBM Corporation 37
• Leadership
• Founding member of Node.js Foundation (1 board member)
• 4 CTC/TSC members (+2 past members)
• Facilitating multiple working groups
Node.js IBM - Node.js Community Involvement
© 2016 IBM Corporation 38
• Regular contributors• Active in working groups
LTS, build, post-mortem, build, security, api, citgm, dev-policy, benchmarking, internationalization
• 11 IBMr’s with commit rights • including #2, #5, #15, #28, #39, #42, #46
• Driving support for platforms - Linux on PPC, AIX and Linux on Z
Node.js IBM - Node.js Community Involvement
© 2016 IBM Corporation 39
• Deep expertise at V8• Developed ports to IBM Platforms• Contribution back to official V8 repositories:
https://github.com/v8/v8• PPC: V8 4.3 and later have full functional PPC implementation• s390: V8 5.1 and later have full functional implementation
• ~10-15 commits per week to V8 to maintain PPC/zlinux port• Port to z/OS in progress:
• https://github.com/ibmruntimes/v8z/tree/3.28-zos
Node.js IBM –V8 Community Involvement
© 2016 IBM Corporation 40
Node.js IBM – Platform Availability
• IBM SDK for Node.js– Shipping Node.js releases since 2013
– 0.10.x + 0.12.x + 4.x + 6.x
– Linux on x / p / z, AIX, Windows, Mac
– Working on support for z/OS
• Community
© 2016 IBM Corporation 41
Node.js Long Term Support (LTS)
https://github.com/nodejs/lts
• Current Release
– every 6 months
– Semver major
• LTS release every
October
– Even semver majors
– 30 months of support
© 2016 IBM Corporation 42
• Appmetrics
• Health Center
• NodeReport
• Core inspection - IDDE/LLNODE
• GCMV
Node.js IBM – Tooling
© 2016 IBM Corporation 43
Node.js IBM – Appmetrics
https://www.npmjs.com/package/appmetrics
© 2016 IBM Corporation 44
Node.js IBM – Tooling - Healthcenter
https://marketplace.eclipse.org/content/
ibm-monitoring-and-diagnostic-tools-
health-center
• Free download
• Node.js + Java
© 2016 IBM Corporation 45
Node.js IBM – Tooling - NodeReport
NodeReport example - heap
out of memory error
NodeReport content:
● Event summary
● Node.js and OS versions
● JavaScript stack trace
● Native stack trace
● Heap and GC statistics
● Resource usage
● libuv handle summary
● Environment variables
● OS ulimit settings
https://github.com/nodejs/nodereport
© 2016 IBM Corporation 46
• MDB/LLNODE/IDDE
• Working in community to
standardize
Node.js IBM – Tooling - Core Inspection
• Free download
• --trace_gc
• --trace_gc_nvp
• --trace_gc_verbose
• Node.js + Java
© 2016 IBM Corporation 47
Node.js IBM – Tooling - GCMV
https://marketplace.eclipse.org/content/ibm-monitoring-and-diagnostic-tools-garbage-collection-and-memory-visualizer-gcmv
Michael Dawson
Thank you very much.
IBMRuntime Technologies
© 2016 IBM Corporation 48
© 2016 IBM Corporation 49
Your feedback is valuable
Please complete your session or lab evaluation!
Session number [A295]
Provide your evaluations by:
Evaluation forms:
Fill out a form at the end of each session
Paper forms are located in each of the session or lab rooms
Complete the session survey on Event Connect Portal: https://portal.ibmeventconnect.com/madrid2016
Select Sessions, then Session Finder, and complete the survey
- Or -
IBMTA16
Twitter@IBMCloud | @IBMWebSphere
LinkedInIBM Cloud
YouTubeIBM Cloud | IBM WebSphere
FacebookIBM Cloud
ibmcloud
Facebook Event PageIBM Techical Academy 2016
websphere
For Additional Information
IBM Commerce Solutions:http://www.ibm.com/commerce/us-en/
IBM Digital Experience Solutionshttp://www-01.ibm.com/software/collaboration/digitalexperience
IBM Commerce Blog:https://www.ibm.com/blogs/commerce/
IBM B2C Commerce:http://www-03.ibm.com/software/products/en/category/b2c-commerce
• IBM Commerce Developer:
http://www.ibm.com/developerworks/commerce/
Copyright © 2016 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission
from IBM.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.
Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial
publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED
"AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS
INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and
services are warranted according to the terms and conditions of the agreements under which they are provided.
Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.
Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers
have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.
References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in
which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and
discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their
specific situation.
It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and
interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such
laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.
Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not
tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products.
Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the
ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual
property right.
• IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™,
FASP®, FileNet®, Global Business Services ®, Global Technology Services ®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand,
ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®,
PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®,
StoredIQ, Tealeaf®, Tivoli®, Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International
Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current
list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
• Node.js is an official trademark of Joyent. IBM SDK for Node.js is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
• Java, JavaScript and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its affiliates.
• npm is a trademark of npm, Inc.