SlideShare a Scribd company logo
© 2015 IBM Corporation1
Java vs Node.js
For Enterprise Web Applications
Chris Bailey
IBM Runtime Technologies
© 2015 IBM Corporation2
What Languages do you use?
Java JavaScript Both
0
20
40
60
80
100
120
PercentageofAudience
© 2015 IBM Corporation3
What Runtimes do you use?
Server Java Applets JS in Browser Node.js Rhino Nashorn Avatar.js
0
20
40
60
80
100
120
PercentageofAudience
© 2015 IBM Corporation4
4
Chris Bailey
IBM Runtime Monitoring and Diagnostics Architect
–14 years working with Java and JVM technologies
–14 months working with Node.js and V8
Current Role(s):
–IBM Java monitoring and diagnostics
–Node Application Metrics project lead
Node Foundation Member
Benchmarking and Performance WGs
JavaOne RockStar
Author on performance and memory analysis
baileyc@uk.ibm.com
chrisbaileyibm
cnbailey
@seabaylea
@Chris__Bailey
© 2015 IBM Corporation5

Language Adoption

Deployment Modes

Code Development

Scalability

WebApplication Performance

Under the Hood

Enterprise Architectures
Agenda
© 2015 IBM Corporation6
6
Language Adoption
© 2015 IBM Corporation7
GitHub Adoption: Java
© 2015 IBM Corporation8
GitHub Adoption: JavaScript
© 2015 IBM Corporation9
modulecounts.com
© 2015 IBM Corporation10
StackOverflow User Survey
© 2015 IBM Corporation11
Ratings based on the number of skilled engineers, courses and third party vendors.
Tiobe Community Programming Index
© 2015 IBM Corporation12
Indeed.com Job Trends: Java
© 2015 IBM Corporation13
Indeed.com Job Trends: JavaScript
© 2015 IBM Corporation14
Indeed.com Job Trends
Java
JavaScript
© 2015 IBM Corporation15

JavaScript has a large developer base
- #1 on GitHub with 45% more active repositories than Java
- #1 on modulecounts.com with 29% more NPM modules than
Maven
- #1 used language by StackOverflow survey responders
- #6 language on the Tiobe index

Java remains huge, particularly in the enterprise and on the server
- #2 on GitHub with 52% more active repositories than the next
language
- #3 on modulecounts with 73.8% more modules than the next
language
- #2 language on the Tiobe index
- #1 on indeed.com for developer jobs
Language Adoption
© 2015 IBM Corporation16
Deployment Modes
© 2015 IBM Corporation17

JavaScript is ubiquitous in the browser
- Supported in every browser
- Integration with HTML and CSS

JavaScript is not affected by negative publicity....
Unless it is absolutely necessary to run Java in web browsers, disable it as described
below, even after updating to 7u11. This will help mitigate other Java vulnerabilities that
may be discovered in the future.
This and previous Java vulnerabilities have been widely targeted by attackers, and
new Java vulnerabilities are likely to be discovered. To defend against this and future
Java vulnerabilities, consider disabling Java in web browsers…
Usage in the browser
© 2015 IBM Corporation18

Java has a long history on the server
- JPE launched in 1998

Java has rich platform support:
- Linux x86, Linux POWER, zLinux
- Windows, Mac OS, Solaris, AIX, z/OS

JavaScript is a nascent language on the server
- Limited platform support – although its growing
- No API support to interact with the OS

Part of the browser security model
- Frameworks like Node.js have changed that.
Usage on the server
© 2015 IBM Corporation19

Single Threaded Event based JavaScript framework
– Uses non-blocking asynchronous I/O

Wraps the Chrome V8 JavaScript engine with I/O interfaces
– Libuv provides interaction with OS/system

Designed to build scalable network applications
– Suited for real time delivery of data to distributed client

Available on a wide set of platforms:
- Linux on x86, ARM, Power and Z
- Windows, Mac OS, Solaris, SmartOS and AIX
libuvV8
Node Bindings
Node Standard Library
C
JavaScript
Server Side JavaScript: Node.js
© 2015 IBM Corporation20
Anatomy of a Node.js application
1. package.json
–
Tracks properties, dependencies, version info, commands, etc.
2. JavaScript source files (i.e. app.js)
•To install and execute:
> npm install
> node app.js
20
© 2015 IBM Corporation21
Code Development
© 2015 IBM Corporation22
var cluster = require('cluster');
var cpus = require('os').cpus().length;
var http = require('http');
if (cluster.isMaster) {
for (var i = 0; i < cpus; i++) {
cluster.fork();
}
cluster.on('death', function(worker) {
console.log("Worker" + worker.pid + "died");
});
} else {
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World!n");
response.end();
}).listen(8080);
}
HTTP Server Example
© 2015 IBM Corporation23
var cluster = require('cluster');
var cpus = require('os').cpus().length;
var http = require('http');
if (cluster.isMaster) {
for (var i = 0; i < cpus; i++) {
cluster.fork();
}
cluster.on('death', function(worker) {
console.log("Worker" + worker.pid + "died");
});
} else {
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World!n");
response.end();
}).listen(8080);
}
Clustered HTTP Server Example
© 2015 IBM Corporation24
Writing Node.js Code
CodeVolumeRelativetoJava
* based on benchmarksgame benchmarks
Node.js
Development Effort
(lower is better)
- 3x
*or other transactional service
© 2015 IBM Corporation25
Writing Node.js Code
regex-dna Spectral-norm fannkuch-redux fasta k-nucleotide Binary-trees n-body Reverse-complement
CodeVolumeRelativetoJava
* based on benchmarksgame benchmarks
Node.js
Development Effort
(lower is better)
- 3x
Avg 1/3rd
less code
*or other transactional service
© 2015 IBM Corporation26
Writing Node.js Code
regex-dna Spectral-norm fannkuch-redux fasta k-nucleotide Binary-trees n-body Reverse-complement
CodeVolumeRelativetoJava
* based on benchmarksgame benchmarks
Node.js
Development Effort
(lower is better)
- 3x
●
Node.js has higher developer productivity
Many applications developed with significantly less code
●
Rich module system simplifies development
Reduces need to develop custom code
Avg 1/3rd
less code
*or other transactional service
© 2015 IBM Corporation27
Scalability
© 2015 IBM Corporation28

One thread (or process) per connection
- Each thread waits on a response
- Scalability determined by the number
of threads

Each thread:
- consumes memory
- is relatively idle

Number of concurrent customers
determined by number of depot workers

Additional customers wait in a queue with no
response
Typical approach to I/O
© 2015 IBM Corporation29

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

Number of concurrent customers
determined by how fast the food Server
can work

Or until the kitchen gets slammed
Asycnhronous Non-Blocking I/O
© 2015 IBM Corporation30

JavaScript is already event based in the browser
- eg. onClick and onMouseOver events

First class functions and closures fit well with events
- Easy to create and pass function callbacks
- Easy to execute callbacks in the context of the event

Node.js execution is based on an event loop
- Asynchronous I/O built in from the ground up

Node.js execution uses a single thread
- No need to worry about locking or shared data
- Most machines are now multi-CPU, so cluster capabilities are
provided
JavaScript and Asynchronous I/O
© 2015 IBM Corporation31
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 programming
© 2015 IBM Corporation32
WebApp Performance
© 2015 IBM Corporation33

JSON serialization of a
newly instantiated object

Maps
- Key of message
- Value of Hello,
World!

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
JSON Serialization
© 2015 IBM Corporation34

JSON serialization of a
newly instantiated object

Maps
- Key of message
- Value of Hello,
World!

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
JSON Serialization
JavaScript
Java
© 2015 IBM Corporation35
JavaScript WebApp Performance
-100
-80
-60
-40
-20
0
20
40
-75
Node.js Performance
(Compared to Java)
JSON Serialization
%ageofJavaPerformance
© 2015 IBM Corporation36

Fetches single row from
simple database table

Row serialized as JSON

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
Single Query
© 2015 IBM Corporation37

Fetches single row from
simple database table

Row serialized as JSON

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
Single Query
JavaScript
Java
© 2015 IBM Corporation38
JavaScript WebApp Performance
-100
-80
-60
-40
-20
0
20
40
-60.5
Node.js Performance
(Compared to Java)
JSON Serialization
Single Query
%ageofJavaPerformance
© 2015 IBM Corporation39

Fetches multiple rows from
a simple database table

Rows serialized as JSON

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
Multiple Queries
© 2015 IBM Corporation40

Fetches multiple rows from
a simple database table

Rows serialized as JSON

Example response:
Results from TechEmpower.com Round 9 tests (2014-05-01)
Multiple Queries
JavaScript
Java
© 2015 IBM Corporation41
JavaScript WebApp Performance
-100
-80
-60
-40
-20
0
20
40
-18
Node.js Performance
(Compared to Java)
JSON Serialization
Single Query
Multiple Queries
%ageofJavaPerformance
© 2015 IBM Corporation42

Fetches multiple rows from
a simple database table

Converts rows to objects
and modifies one attribute
of each object

Updates each associated
row and serializes as
JSON

Example Response:
Data Updates
Results from TechEmpower.com Round 9 tests (2014-05-01)
© 2015 IBM Corporation43

Fetches multiple rows from
a simple database table

Converts rows to objects
and modifies one attribute
of each object

Updates each associated
row and serializes as
JSON

Example Response:
Data Updates
Results from TechEmpower.com Round 9 tests (2014-05-01)
JavaScript
Java
© 2015 IBM Corporation44
JavaScript WebApp Performance
-100
-80
-60
-40
-20
0
20
40
28
Node.js Performance
(Compared to Java)
JSON Serialization
Single Query
Multiple Queries
Data Updates
%ageofJavaPerformance
© 2015 IBM Corporation45

Computation speed is (much) slower than Java

I/O speed is higher than Java
JavaScript WebApp Performance
-100
-80
-60
-40
-20
0
20
40
-75 -60.5 -18
28
Node.js Performance
(Compared to Java)
JSON Serialization
Single Query
Multiple Queries
Data Updates
%ageofJavaPerformance
More
Computation
More
I/O
© 2015 IBM Corporation46
JavaScript
on the JVM?
© 2015 IBM Corporation47
Nashorn and Avatar.js

Nashorn JavaScript engine delivered in JDK8
– Utilizes new JVM level features
for performance

Avatar.js provides Node.js support on Nashorn
© 2015 IBM Corporation48
Nashorn and Avatar.js

Nashorn JavaScript engine delivered in JDK8
– Utilizes new JVM level features
for performance

Avatar.js provides Node.js support on Nashorn

Results of “Octane” JavaScript benchmark*:
– Node.js is 4.8x faster
– Avatar.js is >10x larger
* Using Java 8 pre-u20
© 2015 IBM Corporation49
Nashorn and Avatar.js

Nashorn JavaScript engine delivered in JDK8
– Utilizes new JVM level features
for performance

Avatar.js provides Node.js support on Nashorn

Results of “Octane” JavaScript benchmark*:
– Node.js is 4.8x faster
– Avatar.js is >10x larger
* Using Java 8 pre-u40
Feb 12th
, 2015: Avatar is “put on hold”
https://blogs.oracle.com/theaquarium/entry/project_avatar_update
© 2015 IBM Corporation50
JavaScript Performance
Under the Hood
© 2015 IBM Corporation51

Dynamic nature of JavaScript makes JIT optimizations more difficult
– Any variable could be a function or data
– Variables must be tested to determine how to handle handle them
– Variables can change, so what worked previously many not apply in future

Example: the use of '+':
• number + number → addition
• string involved? → concatenation
• objects involved? → convert to primitives then addition or
concatenation
• Functions involved? → ?
JIT Compilation
© 2015 IBM Corporation52
Execution flow for '+' operator
int a
int b
int c = a + b
Addition
Return Result
Java
© 2015 IBM Corporation53
Execution flow for '+' operator
int a
int b
int c = a + b
Addition
Return Result
var a
var b
var c = a + b
First Time?
NO
Use Previous
Types
Worked?
Return Result
YES
Type of A?
NO
YES
Type of B?String Concatenate
String
or
Number
Number Type of B? Number Addition
UndefinedString
Java JavaScript
© 2015 IBM Corporation54

Dynamically typed languages are harder to manage under the hood

They subsequently have lower runtime performance for computational tasks

Highlighted in TechEmpower benchmarks:
Dynamically vs Statically Types Languages
-70
-60
-50
-40
-30
-20
-10
0
Dynamic vs Statically Typed Language Performance
JSON
Single
Multi
Updates
Bestdynamiccomparedtobeststaticasbaseline
© 2015 IBM Corporation55
Writing
Node.js Code
© 2015 IBM Corporation56
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation57
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation58
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation59
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation60
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation61
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation62
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation63
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation64
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation65
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation66
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation67
Not So Easy: JavaScript Syntax Fun
> '5' – 3
2 // Weak typing, implicit conversion
> '5' + 3
'53' // ...but not consistent
> '5' – '4'
1 // String minus String = Integer??
> '5' + + '4'
54 // Multiple +'s are ok
> 'Hello' + 'World'
'HelloWorld' // Ok, that's expected
> 'Hello' + + 'World'
'HelloNaN' // ...but that isn't
© 2015 IBM Corporation68
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-2' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation69
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-5' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation70
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-2' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation71
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-2' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation72
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-2' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation73
Not So Easy: JavaScript Syntax Fun
> '5' + - '5'
'5-2' // I can just about see that works
> var x = 3
undefined
> '5' – x + x
5 // Ok, that makes sense
> var x = 3
undefined
> '5' + x - x
50 // What???
© 2015 IBM Corporation74
(Micro)Service
Topologies
© 2015 IBM Corporation75
Enterprise Application Platform – Web Applications
Operations and Management
Admin Analytics
LoadBalancer
LoadBalancer
HTTP
Monitoring ScalingAnalytics Diagnostics
© 2015 IBM Corporation76
Questions
© 2015 IBM Corporation77

More Related Content

PDF
JavaOne 2014: Java vs JavaScript
PDF
IBM InterConnect: Java vs JavaScript for Enterprise WebApps
PDF
InterConnect2016: WebApp Architectures with Java and Node.js
PDF
IBM Monitoring and Diagnostics Tools - Health Center 3.0.2
PDF
Impact2014: Practical Performance Troubleshooting
PDF
Impact2014: Introduction to the IBM Java Tools
PPTX
Node Summit 2016: Web App Architectures
PDF
QCon Shanghai: Trends in Application Development
JavaOne 2014: Java vs JavaScript
IBM InterConnect: Java vs JavaScript for Enterprise WebApps
InterConnect2016: WebApp Architectures with Java and Node.js
IBM Monitoring and Diagnostics Tools - Health Center 3.0.2
Impact2014: Practical Performance Troubleshooting
Impact2014: Introduction to the IBM Java Tools
Node Summit 2016: Web App Architectures
QCon Shanghai: Trends in Application Development

What's hot (20)

PDF
InterConnect2016 Monitoring Nodejs
PDF
Swift Summit: Pushing the boundaries of Swift to the Server
PPT
Cloud Economics
PDF
JavaOne 2015: From Java Code to Machine Code
PDF
O'Reilly Software Architecture Conf: Cloud Economics
PDF
JavaOne2013: Build Your Own Runtime Monitoring for the IBM JDK with the Healt...
PDF
FrenchKit: End to End Application Development with Swift
PDF
JavaOne2013: Securing Java in the Server Room - Tim Ellison
PDF
Puppet devops wdec
PPT
Reactive Java EE - Let Me Count the Ways!
PDF
Breaking Bad CSP
PPT
Ten things you should know when writing good unit test cases
PDF
How to secure your web applications with NGINX
PDF
De 03 Introduction To V Cloud Api V1
PDF
Spring5 New Features - Nov, 2017
PDF
Great Java Application Server Debate
PDF
Staying Ahead of the Curve with Spring and Cassandra 4 (SpringOne 2020)
PDF
JVMs in Containers
PPTX
Core Spring + Reactive 김민석
PDF
Spring Boot & Actuators
InterConnect2016 Monitoring Nodejs
Swift Summit: Pushing the boundaries of Swift to the Server
Cloud Economics
JavaOne 2015: From Java Code to Machine Code
O'Reilly Software Architecture Conf: Cloud Economics
JavaOne2013: Build Your Own Runtime Monitoring for the IBM JDK with the Healt...
FrenchKit: End to End Application Development with Swift
JavaOne2013: Securing Java in the Server Room - Tim Ellison
Puppet devops wdec
Reactive Java EE - Let Me Count the Ways!
Breaking Bad CSP
Ten things you should know when writing good unit test cases
How to secure your web applications with NGINX
De 03 Introduction To V Cloud Api V1
Spring5 New Features - Nov, 2017
Great Java Application Server Debate
Staying Ahead of the Curve with Spring and Cassandra 4 (SpringOne 2020)
JVMs in Containers
Core Spring + Reactive 김민석
Spring Boot & Actuators
Ad

Viewers also liked (7)

PDF
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
PPTX
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
PDF
Node.js and How JavaScript is Changing Server Programming
PDF
Cucumber.js: Cuke up your JavaScript!
PPTX
The Java memory model made easy
PDF
Nodejs Explained with Examples
PPTX
Introduction to Node.js
Conquer Architectural Challenges with End-to-End JavaScript - enterJS 2014
OSCON 2013 - The Hitchiker’s Guide to Open Source Cloud Computing
Node.js and How JavaScript is Changing Server Programming
Cucumber.js: Cuke up your JavaScript!
The Java memory model made easy
Nodejs Explained with Examples
Introduction to Node.js
Ad

Similar to JAX London 2015: Java vs Nodejs (20)

PPTX
AJppt.pptx
PDF
Node.js vs Play Framework
PDF
Original slides from Ryan Dahl's NodeJs intro talk
PPTX
PPTX
Event-driven IO server-side JavaScript environment based on V8 Engine
PPTX
01 overview-servlets-and-environment-setup
PPTX
Java on Windows Azure
PPTX
NodeJS
PPTX
introduction to node.js
PDF
Node.js Workshop
PPTX
StrongLoop Overview
PDF
soft-shake.ch - Hands on Node.js
PPTX
CloudConnect 2011 - Building Highly Scalable Java Applications on Windows Azure
PPT
Web II - 01 - Introduction to server-side development
PPTX
Node.js primer for ITE students
PDF
Choose Your Own Adventure with JHipster & Kubernetes - Denver JUG 2020
KEY
node.js: Javascript's in your backend
PPTX
Web assembly with PWA
PDF
Server Side JavaScript on the Java Platform - David Delabassee
PPTX
AJppt.pptx
Node.js vs Play Framework
Original slides from Ryan Dahl's NodeJs intro talk
Event-driven IO server-side JavaScript environment based on V8 Engine
01 overview-servlets-and-environment-setup
Java on Windows Azure
NodeJS
introduction to node.js
Node.js Workshop
StrongLoop Overview
soft-shake.ch - Hands on Node.js
CloudConnect 2011 - Building Highly Scalable Java Applications on Windows Azure
Web II - 01 - Introduction to server-side development
Node.js primer for ITE students
Choose Your Own Adventure with JHipster & Kubernetes - Denver JUG 2020
node.js: Javascript's in your backend
Web assembly with PWA
Server Side JavaScript on the Java Platform - David Delabassee

More from Chris Bailey (20)

PDF
NodeJS Interactive 2019: FaaS meets Frameworks
PDF
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
PDF
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
PDF
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
PDF
AltConf 2019: Server-Side Swift State of the Union
PDF
Server-side Swift with Swagger
PDF
Node Summit 2018: Cloud Native Node.js
PDF
Index - BFFs vs GraphQL
PDF
Swift Cloud Workshop - Swift Microservices
PDF
Swift Cloud Workshop - Codable, the key to Fullstack Swift
PDF
Try!Swift India 2017: All you need is Swift
PDF
Swift Summit 2017: Server Swift State of the Union
PDF
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
PDF
IBM Cloud University: Java, Node.js and Swift
PDF
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
PDF
FrenchKit 2017: Server(less) Swift
PDF
AltConf 2017: Full Stack Swift in 30 Minutes
PDF
InterConnect: Server Side Swift for Java Developers
PDF
InterConnect: Java, Node.js and Swift - Which, Why and When
PDF
Playgrounds: Mobile + Swift = BFF
NodeJS Interactive 2019: FaaS meets Frameworks
Voxxed Micro-services: Serverless JakartaEE - JAX-RS comes to FaaS
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
FaaS Meets Java EE: Developing Cloud Native Applications at Speed
AltConf 2019: Server-Side Swift State of the Union
Server-side Swift with Swagger
Node Summit 2018: Cloud Native Node.js
Index - BFFs vs GraphQL
Swift Cloud Workshop - Swift Microservices
Swift Cloud Workshop - Codable, the key to Fullstack Swift
Try!Swift India 2017: All you need is Swift
Swift Summit 2017: Server Swift State of the Union
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Java, Node.js and Swift
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
FrenchKit 2017: Server(less) Swift
AltConf 2017: Full Stack Swift in 30 Minutes
InterConnect: Server Side Swift for Java Developers
InterConnect: Java, Node.js and Swift - Which, Why and When
Playgrounds: Mobile + Swift = BFF

Recently uploaded (20)

PDF
Designing Intelligence for the Shop Floor.pdf
PDF
medical staffing services at VALiNTRY
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
assetexplorer- product-overview - presentation
PDF
Salesforce Agentforce AI Implementation.pdf
PPTX
history of c programming in notes for students .pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Complete Guide to Website Development in Malaysia for SMEs
Designing Intelligence for the Shop Floor.pdf
medical staffing services at VALiNTRY
Digital Systems & Binary Numbers (comprehensive )
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
L1 - Introduction to python Backend.pptx
Operating system designcfffgfgggggggvggggggggg
assetexplorer- product-overview - presentation
Salesforce Agentforce AI Implementation.pdf
history of c programming in notes for students .pptx
Odoo Companies in India – Driving Business Transformation.pdf
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
AMADEUS TRAVEL AGENT SOFTWARE | AMADEUS TICKETING SYSTEM
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Navsoft: AI-Powered Business Solutions & Custom Software Development
Computer Software and OS of computer science of grade 11.pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
Reimagine Home Health with the Power of Agentic AI​
17 Powerful Integrations Your Next-Gen MLM Software Needs
CHAPTER 2 - PM Management and IT Context
Complete Guide to Website Development in Malaysia for SMEs

JAX London 2015: Java vs Nodejs

  • 1. © 2015 IBM Corporation1 Java vs Node.js For Enterprise Web Applications Chris Bailey IBM Runtime Technologies
  • 2. © 2015 IBM Corporation2 What Languages do you use? Java JavaScript Both 0 20 40 60 80 100 120 PercentageofAudience
  • 3. © 2015 IBM Corporation3 What Runtimes do you use? Server Java Applets JS in Browser Node.js Rhino Nashorn Avatar.js 0 20 40 60 80 100 120 PercentageofAudience
  • 4. © 2015 IBM Corporation4 4 Chris Bailey IBM Runtime Monitoring and Diagnostics Architect –14 years working with Java and JVM technologies –14 months working with Node.js and V8 Current Role(s): –IBM Java monitoring and diagnostics –Node Application Metrics project lead Node Foundation Member Benchmarking and Performance WGs JavaOne RockStar Author on performance and memory analysis [email protected] chrisbaileyibm cnbailey @seabaylea @Chris__Bailey
  • 5. © 2015 IBM Corporation5  Language Adoption  Deployment Modes  Code Development  Scalability  WebApplication Performance  Under the Hood  Enterprise Architectures Agenda
  • 6. © 2015 IBM Corporation6 6 Language Adoption
  • 7. © 2015 IBM Corporation7 GitHub Adoption: Java
  • 8. © 2015 IBM Corporation8 GitHub Adoption: JavaScript
  • 9. © 2015 IBM Corporation9 modulecounts.com
  • 10. © 2015 IBM Corporation10 StackOverflow User Survey
  • 11. © 2015 IBM Corporation11 Ratings based on the number of skilled engineers, courses and third party vendors. Tiobe Community Programming Index
  • 12. © 2015 IBM Corporation12 Indeed.com Job Trends: Java
  • 13. © 2015 IBM Corporation13 Indeed.com Job Trends: JavaScript
  • 14. © 2015 IBM Corporation14 Indeed.com Job Trends Java JavaScript
  • 15. © 2015 IBM Corporation15  JavaScript has a large developer base - #1 on GitHub with 45% more active repositories than Java - #1 on modulecounts.com with 29% more NPM modules than Maven - #1 used language by StackOverflow survey responders - #6 language on the Tiobe index  Java remains huge, particularly in the enterprise and on the server - #2 on GitHub with 52% more active repositories than the next language - #3 on modulecounts with 73.8% more modules than the next language - #2 language on the Tiobe index - #1 on indeed.com for developer jobs Language Adoption
  • 16. © 2015 IBM Corporation16 Deployment Modes
  • 17. © 2015 IBM Corporation17  JavaScript is ubiquitous in the browser - Supported in every browser - Integration with HTML and CSS  JavaScript is not affected by negative publicity.... Unless it is absolutely necessary to run Java in web browsers, disable it as described below, even after updating to 7u11. This will help mitigate other Java vulnerabilities that may be discovered in the future. This and previous Java vulnerabilities have been widely targeted by attackers, and new Java vulnerabilities are likely to be discovered. To defend against this and future Java vulnerabilities, consider disabling Java in web browsers… Usage in the browser
  • 18. © 2015 IBM Corporation18  Java has a long history on the server - JPE launched in 1998  Java has rich platform support: - Linux x86, Linux POWER, zLinux - Windows, Mac OS, Solaris, AIX, z/OS  JavaScript is a nascent language on the server - Limited platform support – although its growing - No API support to interact with the OS  Part of the browser security model - Frameworks like Node.js have changed that. Usage on the server
  • 19. © 2015 IBM Corporation19  Single Threaded Event based JavaScript framework – Uses non-blocking asynchronous I/O  Wraps the Chrome V8 JavaScript engine with I/O interfaces – Libuv provides interaction with OS/system  Designed to build scalable network applications – Suited for real time delivery of data to distributed client  Available on a wide set of platforms: - Linux on x86, ARM, Power and Z - Windows, Mac OS, Solaris, SmartOS and AIX libuvV8 Node Bindings Node Standard Library C JavaScript Server Side JavaScript: Node.js
  • 20. © 2015 IBM Corporation20 Anatomy of a Node.js application 1. package.json – Tracks properties, dependencies, version info, commands, etc. 2. JavaScript source files (i.e. app.js) •To install and execute: > npm install > node app.js 20
  • 21. © 2015 IBM Corporation21 Code Development
  • 22. © 2015 IBM Corporation22 var cluster = require('cluster'); var cpus = require('os').cpus().length; var http = require('http'); if (cluster.isMaster) { for (var i = 0; i < cpus; i++) { cluster.fork(); } cluster.on('death', function(worker) { console.log("Worker" + worker.pid + "died"); }); } else { http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World!n"); response.end(); }).listen(8080); } HTTP Server Example
  • 23. © 2015 IBM Corporation23 var cluster = require('cluster'); var cpus = require('os').cpus().length; var http = require('http'); if (cluster.isMaster) { for (var i = 0; i < cpus; i++) { cluster.fork(); } cluster.on('death', function(worker) { console.log("Worker" + worker.pid + "died"); }); } else { http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World!n"); response.end(); }).listen(8080); } Clustered HTTP Server Example
  • 24. © 2015 IBM Corporation24 Writing Node.js Code CodeVolumeRelativetoJava * based on benchmarksgame benchmarks Node.js Development Effort (lower is better) - 3x *or other transactional service
  • 25. © 2015 IBM Corporation25 Writing Node.js Code regex-dna Spectral-norm fannkuch-redux fasta k-nucleotide Binary-trees n-body Reverse-complement CodeVolumeRelativetoJava * based on benchmarksgame benchmarks Node.js Development Effort (lower is better) - 3x Avg 1/3rd less code *or other transactional service
  • 26. © 2015 IBM Corporation26 Writing Node.js Code regex-dna Spectral-norm fannkuch-redux fasta k-nucleotide Binary-trees n-body Reverse-complement CodeVolumeRelativetoJava * based on benchmarksgame benchmarks Node.js Development Effort (lower is better) - 3x ● Node.js has higher developer productivity Many applications developed with significantly less code ● Rich module system simplifies development Reduces need to develop custom code Avg 1/3rd less code *or other transactional service
  • 27. © 2015 IBM Corporation27 Scalability
  • 28. © 2015 IBM Corporation28  One thread (or process) per connection - Each thread waits on a response - Scalability determined by the number of threads  Each thread: - consumes memory - is relatively idle  Number of concurrent customers determined by number of depot workers  Additional customers wait in a queue with no response Typical approach to I/O
  • 29. © 2015 IBM Corporation29  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  Number of concurrent customers determined by how fast the food Server can work  Or until the kitchen gets slammed Asycnhronous Non-Blocking I/O
  • 30. © 2015 IBM Corporation30  JavaScript is already event based in the browser - eg. onClick and onMouseOver events  First class functions and closures fit well with events - Easy to create and pass function callbacks - Easy to execute callbacks in the context of the event  Node.js execution is based on an event loop - Asynchronous I/O built in from the ground up  Node.js execution uses a single thread - No need to worry about locking or shared data - Most machines are now multi-CPU, so cluster capabilities are provided JavaScript and Asynchronous I/O
  • 31. © 2015 IBM Corporation31 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 programming
  • 32. © 2015 IBM Corporation32 WebApp Performance
  • 33. © 2015 IBM Corporation33  JSON serialization of a newly instantiated object  Maps - Key of message - Value of Hello, World!  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) JSON Serialization
  • 34. © 2015 IBM Corporation34  JSON serialization of a newly instantiated object  Maps - Key of message - Value of Hello, World!  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) JSON Serialization JavaScript Java
  • 35. © 2015 IBM Corporation35 JavaScript WebApp Performance -100 -80 -60 -40 -20 0 20 40 -75 Node.js Performance (Compared to Java) JSON Serialization %ageofJavaPerformance
  • 36. © 2015 IBM Corporation36  Fetches single row from simple database table  Row serialized as JSON  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) Single Query
  • 37. © 2015 IBM Corporation37  Fetches single row from simple database table  Row serialized as JSON  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) Single Query JavaScript Java
  • 38. © 2015 IBM Corporation38 JavaScript WebApp Performance -100 -80 -60 -40 -20 0 20 40 -60.5 Node.js Performance (Compared to Java) JSON Serialization Single Query %ageofJavaPerformance
  • 39. © 2015 IBM Corporation39  Fetches multiple rows from a simple database table  Rows serialized as JSON  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) Multiple Queries
  • 40. © 2015 IBM Corporation40  Fetches multiple rows from a simple database table  Rows serialized as JSON  Example response: Results from TechEmpower.com Round 9 tests (2014-05-01) Multiple Queries JavaScript Java
  • 41. © 2015 IBM Corporation41 JavaScript WebApp Performance -100 -80 -60 -40 -20 0 20 40 -18 Node.js Performance (Compared to Java) JSON Serialization Single Query Multiple Queries %ageofJavaPerformance
  • 42. © 2015 IBM Corporation42  Fetches multiple rows from a simple database table  Converts rows to objects and modifies one attribute of each object  Updates each associated row and serializes as JSON  Example Response: Data Updates Results from TechEmpower.com Round 9 tests (2014-05-01)
  • 43. © 2015 IBM Corporation43  Fetches multiple rows from a simple database table  Converts rows to objects and modifies one attribute of each object  Updates each associated row and serializes as JSON  Example Response: Data Updates Results from TechEmpower.com Round 9 tests (2014-05-01) JavaScript Java
  • 44. © 2015 IBM Corporation44 JavaScript WebApp Performance -100 -80 -60 -40 -20 0 20 40 28 Node.js Performance (Compared to Java) JSON Serialization Single Query Multiple Queries Data Updates %ageofJavaPerformance
  • 45. © 2015 IBM Corporation45  Computation speed is (much) slower than Java  I/O speed is higher than Java JavaScript WebApp Performance -100 -80 -60 -40 -20 0 20 40 -75 -60.5 -18 28 Node.js Performance (Compared to Java) JSON Serialization Single Query Multiple Queries Data Updates %ageofJavaPerformance More Computation More I/O
  • 46. © 2015 IBM Corporation46 JavaScript on the JVM?
  • 47. © 2015 IBM Corporation47 Nashorn and Avatar.js  Nashorn JavaScript engine delivered in JDK8 – Utilizes new JVM level features for performance  Avatar.js provides Node.js support on Nashorn
  • 48. © 2015 IBM Corporation48 Nashorn and Avatar.js  Nashorn JavaScript engine delivered in JDK8 – Utilizes new JVM level features for performance  Avatar.js provides Node.js support on Nashorn  Results of “Octane” JavaScript benchmark*: – Node.js is 4.8x faster – Avatar.js is >10x larger * Using Java 8 pre-u20
  • 49. © 2015 IBM Corporation49 Nashorn and Avatar.js  Nashorn JavaScript engine delivered in JDK8 – Utilizes new JVM level features for performance  Avatar.js provides Node.js support on Nashorn  Results of “Octane” JavaScript benchmark*: – Node.js is 4.8x faster – Avatar.js is >10x larger * Using Java 8 pre-u40 Feb 12th , 2015: Avatar is “put on hold” https://blogs.oracle.com/theaquarium/entry/project_avatar_update
  • 50. © 2015 IBM Corporation50 JavaScript Performance Under the Hood
  • 51. © 2015 IBM Corporation51  Dynamic nature of JavaScript makes JIT optimizations more difficult – Any variable could be a function or data – Variables must be tested to determine how to handle handle them – Variables can change, so what worked previously many not apply in future  Example: the use of '+': • number + number → addition • string involved? → concatenation • objects involved? → convert to primitives then addition or concatenation • Functions involved? → ? JIT Compilation
  • 52. © 2015 IBM Corporation52 Execution flow for '+' operator int a int b int c = a + b Addition Return Result Java
  • 53. © 2015 IBM Corporation53 Execution flow for '+' operator int a int b int c = a + b Addition Return Result var a var b var c = a + b First Time? NO Use Previous Types Worked? Return Result YES Type of A? NO YES Type of B?String Concatenate String or Number Number Type of B? Number Addition UndefinedString Java JavaScript
  • 54. © 2015 IBM Corporation54  Dynamically typed languages are harder to manage under the hood  They subsequently have lower runtime performance for computational tasks  Highlighted in TechEmpower benchmarks: Dynamically vs Statically Types Languages -70 -60 -50 -40 -30 -20 -10 0 Dynamic vs Statically Typed Language Performance JSON Single Multi Updates Bestdynamiccomparedtobeststaticasbaseline
  • 55. © 2015 IBM Corporation55 Writing Node.js Code
  • 56. © 2015 IBM Corporation56 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 57. © 2015 IBM Corporation57 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 58. © 2015 IBM Corporation58 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 59. © 2015 IBM Corporation59 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 60. © 2015 IBM Corporation60 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 61. © 2015 IBM Corporation61 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 62. © 2015 IBM Corporation62 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 63. © 2015 IBM Corporation63 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 64. © 2015 IBM Corporation64 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 65. © 2015 IBM Corporation65 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 66. © 2015 IBM Corporation66 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 67. © 2015 IBM Corporation67 Not So Easy: JavaScript Syntax Fun > '5' – 3 2 // Weak typing, implicit conversion > '5' + 3 '53' // ...but not consistent > '5' – '4' 1 // String minus String = Integer?? > '5' + + '4' 54 // Multiple +'s are ok > 'Hello' + 'World' 'HelloWorld' // Ok, that's expected > 'Hello' + + 'World' 'HelloNaN' // ...but that isn't
  • 68. © 2015 IBM Corporation68 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-2' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 69. © 2015 IBM Corporation69 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-5' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 70. © 2015 IBM Corporation70 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-2' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 71. © 2015 IBM Corporation71 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-2' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 72. © 2015 IBM Corporation72 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-2' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 73. © 2015 IBM Corporation73 Not So Easy: JavaScript Syntax Fun > '5' + - '5' '5-2' // I can just about see that works > var x = 3 undefined > '5' – x + x 5 // Ok, that makes sense > var x = 3 undefined > '5' + x - x 50 // What???
  • 74. © 2015 IBM Corporation74 (Micro)Service Topologies
  • 75. © 2015 IBM Corporation75 Enterprise Application Platform – Web Applications Operations and Management Admin Analytics LoadBalancer LoadBalancer HTTP Monitoring ScalingAnalytics Diagnostics
  • 76. © 2015 IBM Corporation76 Questions
  • 77. © 2015 IBM Corporation77