interconnect2016: webapp architectures with java and node.js

115
Emerging Web App Architectures Using Java and Node.js

Upload: chris-bailey

Post on 14-Apr-2017

695 views

Category:

Software


1 download

TRANSCRIPT

Page 1: InterConnect2016: WebApp Architectures with Java and Node.js

Emerging Web App ArchitecturesUsing Java and Node.js

Page 2: InterConnect2016: WebApp Architectures with Java and Node.js

IMPORTANT info regarding IBM speaker guidelines and disclaimers

• If your presentation has forward looking content, it is mandatory that you put the forward disclaimer as slide 2 in your presentation (this is the “Please Note” slide, third slide down in this template).

• All presentations, whether they have future content or not, must include the mandatory “Notices and Disclaimers” – slides 8 and 9 in the template. Insert these slides just before the “Thank You” slide in your deck.

• Please refer to the FAQ document in the Speaker Kit regarding additional legal guidance for use of photos, logos, customer references and analyst information.

• It is recommended to have your material reviewed by Legal if you have any concerns regarding your content.

• Please submit your final presentation, using the instructions in the online Speaker Kit, by February 5th, 2016. Post your final file in native format using the following naming convention: session code.ppt (For example, 1576.ppt)

• Disclosures regarding forward guidance is embedded in the tool and also available through this link: • https://w3-03.ibm.com/finance/finsubp.nsf/WebPages/N01FF08SoftwareRevenueRecognitionGuidelinesRelatedtoProductDisclosures

• Please remove these instructions before finalizing your presentation.

2

Page 3: InterConnect2016: WebApp Architectures with Java and Node.js

Please Note:

3

• IBM’s statements regarding its plans, directions, and intent are subject to change or withdrawal without notice at IBM’s sole discretion.

• Information regarding potential future products is intended to outline our general product direction and it should not be relied on in making a purchasing decision.

• The information mentioned regarding potential future products is not a commitment, promise, or legal obligation to deliver any material, code or functionality. Information about potential future products may not be incorporated into any contract.

• The development, release, and timing of any future features or functionality described for our products remains at our sole discretion.

• Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user’s job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.

Page 4: InterConnect2016: WebApp Architectures with Java and Node.js

© 2015 IBM Corporation4 1

STSM, IBM Runtime Development

@Chris__Bailey

@seabaylea

Page 5: InterConnect2016: WebApp Architectures with Java and Node.js

5

+

Node.js and Java

Page 6: InterConnect2016: WebApp Architectures with Java and Node.js

6

Developer Productivity

Page 7: InterConnect2016: WebApp Architectures with Java and Node.js

7

API Package Support

● Node.js growth: ● 371 packages/day

● Java growth: ● 92 packages/day

Page 8: InterConnect2016: WebApp Architectures with Java and Node.js

8

Open Source Projects

Page 9: InterConnect2016: WebApp Architectures with Java and Node.js

9

Open Source Projects

Page 10: InterConnect2016: WebApp Architectures with Java and Node.js

10

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); }

Writing a HTTP Server

Page 11: InterConnect2016: WebApp Architectures with Java and Node.js

11

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); }

And Clustering It….

Page 12: InterConnect2016: WebApp Architectures with Java and Node.js

12

● 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

● Concurrency determined by number of depot workers

Typical Java Approach to Scalable I/O

Page 13: InterConnect2016: WebApp Architectures with Java and Node.js

13

● 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 approach to Scalable I/O

Page 14: InterConnect2016: WebApp Architectures with Java and Node.js

14

Node.js event based programming

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) {});

Page 15: InterConnect2016: WebApp Architectures with Java and Node.js

15

0

500

1000

1500

2000

2500

3000

regex-dna

n-body

binary-trees

spectral-norm

fannkuch-redux

reverse-compliment

k-nucleo>de

fasta

VolumeofCod

e

Node.js

Java

● Average 45% less code required for Node.js implementation

Code required to implement benchmarks

Page 16: InterConnect2016: WebApp Architectures with Java and Node.js

16

“Fullstack” Development

Page 17: InterConnect2016: WebApp Architectures with Java and Node.js

17

● The web has moved from Web Sites to Web Applications

From Web Sites to Web Apps

Page 18: InterConnect2016: WebApp Architectures with Java and Node.js

● JavaScript is ubiquitous in the browser - Supported in every browser - Integration with HTML and CSS

● JavaScript is not affected by negative publicity....

18

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…

Programming in the Browser

Page 19: InterConnect2016: WebApp Architectures with Java and Node.js

19

FullStack JavaScript Development

● Reuse of programming skills and teams ● Reuse of skills for both client and server side code

● Reuse of “isomorphic” code components ● Reuse of code for both client and server ● Write One Run Anywhere

● Faster user experience performance ● Use of server side rendering

Page 20: InterConnect2016: WebApp Architectures with Java and Node.js

20

Server Side Rendering

● Pre-Initialisation of the client UI on the server:

● Improves time for the first elements appearing in the UI

● Has additional benefits: ● Search Engine Indexing ● Easier code maintenance

Page 21: InterConnect2016: WebApp Architectures with Java and Node.js

21

Variable Types

Page 22: InterConnect2016: WebApp Architectures with Java and Node.js

22

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ int a = 5; int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = 5; var b = 3;

add(a, b);

> node app.js

> 8

Page 23: InterConnect2016: WebApp Architectures with Java and Node.js

23

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ int a = 5; int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = 5; var b = 3;

add(a, b);

> node app.js

> 8

Page 24: InterConnect2016: WebApp Architectures with Java and Node.js

24

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ int a = 5; int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = 5; var b = 3;

add(a, b);

> node app.js

> 8

Page 25: InterConnect2016: WebApp Architectures with Java and Node.js

25

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ int a = 5; int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = 5; var b = 3;

add(a, b);

> node app.js

> 8

Page 26: InterConnect2016: WebApp Architectures with Java and Node.js

26

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ int a = 5; int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = 5; var b = 3;

add(a, b);

> node app.js

> 8

Page 27: InterConnect2016: WebApp Architectures with Java and Node.js

27

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ String a = new String(“5”); int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = ‘5’; var b = 3;

add(a, b);

> node app.js

> 8

Page 28: InterConnect2016: WebApp Architectures with Java and Node.js

28

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ String a = new String(“5”); int b = 3;

add(a, b); }

> javac app.java > java app

> 8

var add = function (a, b) { console.log(a + b); }

var a = ‘5’; var b = 3;

add(a, b);

> node app.js

> 8

Page 29: InterConnect2016: WebApp Architectures with Java and Node.js

29

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ String a = new String(“5”); int b = 3;

add(a, b); }

> javac app.java Error: incompatible types: String cannot be converted to int add(a, b); ^

var add = function (a, b) { console.log(a + b); }

var a = ‘5’; var b = 3;

add(a, b);

> node app.js

> 8

Page 30: InterConnect2016: WebApp Architectures with Java and Node.js

30

Simple Calculation: 5 + 3

private static void add (int a, int b){ System.out.println(a + b); }

public static void main(String[] args){ String a = new String(“5”); int b = 3;

add(a, b); }

> javac app.java Error: incompatible types: String cannot be converted to int add(a, b); ^

var add = function (a, b) { console.log(a + b); }

var a = ‘5’; var b = 3;

add(a, b);

> node app.js

> 53

Page 31: InterConnect2016: WebApp Architectures with Java and Node.js

31

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // Weak typing, implicit conversion

> '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

Page 32: InterConnect2016: WebApp Architectures with Java and Node.js

32

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // Weak typing, implicit conversion

> '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

Page 33: InterConnect2016: WebApp Architectures with Java and Node.js

33

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '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

Page 34: InterConnect2016: WebApp Architectures with Java and Node.js

34

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '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

Page 35: InterConnect2016: WebApp Architectures with Java and Node.js

35

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 36: InterConnect2016: WebApp Architectures with Java and Node.js

36

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 37: InterConnect2016: WebApp Architectures with Java and Node.js

37

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 38: InterConnect2016: WebApp Architectures with Java and Node.js

38

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 39: InterConnect2016: WebApp Architectures with Java and Node.js

39

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 40: InterConnect2016: WebApp Architectures with Java and Node.js

40

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // ...but that isn't

Page 41: InterConnect2016: WebApp Architectures with Java and Node.js

41

JavaScript Calculations

> 5 + 3 8

> '5' + 3 '53'

> '5' – 3 2 // String is converted to a number for subtraction

> '5' – '4' 1 // Both Strings converted to number for subtraction

> '5' + + '4' 54 // Multiple +'s are ok

> 'Hello' + 'World' 'HelloWorld' // Ok, that's expected

> 'Hello' + + 'World' 'HelloNaN' // Multiple plus must cause String to number conversion

Page 42: InterConnect2016: WebApp Architectures with Java and Node.js

42

JavaScript Calculations

> '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???

Page 43: InterConnect2016: WebApp Architectures with Java and Node.js

43

JavaScript Calculations

> '5' + - '5' '5-2' // I can just about see that works

> var x = 3 > '5' – x + x 5 // Ok, that makes sense

> var x = 3 undefined > '5' + x - x 50 // What???

Page 44: InterConnect2016: WebApp Architectures with Java and Node.js

44

JavaScript Calculations

> '5' + - '5' '5-2' // I can just about see that works

> var x = 3 > '5' – x + x 5 // Ok, that makes sense

> var x = 3 > '5' + x - x 50 // What???

Page 45: InterConnect2016: WebApp Architectures with Java and Node.js

45

Performance

Page 46: InterConnect2016: WebApp Architectures with Java and Node.js

● JSON serialization of a newly instantiated object

● Maps - Key of message - Value of Hello, World!

● Example response:

46Results from TechEmpower.com Round 9 tests (2014-05-01)

JSON Serialisation

Page 47: InterConnect2016: WebApp Architectures with Java and Node.js

● JSON serialization of a newly instantiated object

● Maps - Key of message - Value of Hello, World!

● Example response:

47Results from TechEmpower.com Round 9 tests (2014-05-01)

JSON Serialisation

Java

JavaScript

Page 48: InterConnect2016: WebApp Architectures with Java and Node.js

48

-100

-80

-60

-40

-20

0

20

40

-75

Node.js Performance

(Compared to Java)

JSON Serialization

%ag

e of

Jav

a P

erfo

rman

ce

Node.js Web App Performance vs. Java

Page 49: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches single row from simple database table

● Row serialized as JSON

● Example response:

49Results from TechEmpower.com Round 9 tests (2014-05-01)

Single Query

Page 50: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches single row from simple database table

● Row serialized as JSON

● Example response:

50Results from TechEmpower.com Round 9 tests (2014-05-01)

Single Query

Java

JavaScript

Page 51: InterConnect2016: WebApp Architectures with Java and Node.js

51

-100

-80

-60

-40

-20

0

20

40

-75

Node.js Performance

(Compared to Java)

JSON Serialization

%ag

e of

Jav

a P

erfo

rman

ce

Node.js Web App Performance vs. Java

Page 52: InterConnect2016: WebApp Architectures with Java and Node.js

-100

-80

-60

-40

-20

0

20

40

-60.5

Node.js Performance

(Compared to Java)

JSON SerializationSingle Query

%ag

e of

Jav

a P

erfo

rman

ce

52

Node.js Web App Performance vs. Java

Page 53: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches multiple rows from a simple database table

● Rows serialized as JSON

● Example response:

53Results from TechEmpower.com Round 9 tests (2014-05-01)

Multiple Queries

Page 54: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches multiple rows from a simple database table

● Rows serialized as JSON

● Example response:

54Results from TechEmpower.com Round 9 tests (2014-05-01)

Multiple Queries

Java

JavaScript

Page 55: InterConnect2016: WebApp Architectures with Java and Node.js

-100

-80

-60

-40

-20

0

20

40

-60.5

Node.js Performance

(Compared to Java)

JSON SerializationSingle Query

%ag

e of

Jav

a P

erfo

rman

ce

55

Node.js Web App Performance vs. Java

Page 56: InterConnect2016: WebApp Architectures with Java and Node.js

56

Node.js Web App Performance vs. Java

-100

-80

-60

-40

-20

0

20

40

-18

Node.js Performance

(Compared to Java)

JSON SerializationSingle QueryMultiple Queries

%ag

e of

Jav

a P

erfo

rman

ce

Page 57: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches multiple rows from a table ● Converts rows to objects and

modifies one attribute of each object ● Updates each associated row and

serializes as JSON ● Example Response:

57Results from TechEmpower.com Round 9 tests (2014-05-01)

Data Updates

Page 58: InterConnect2016: WebApp Architectures with Java and Node.js

● Fetches multiple rows from a table ● Converts rows to objects and

modifies one attribute of each object ● Updates each associated row and

serializes as JSON ● Example Response:

58Results from TechEmpower.com Round 9 tests (2014-05-01)

Data Updates

Java

JavaScript

Page 59: InterConnect2016: WebApp Architectures with Java and Node.js

59

Node.js Web App Performance vs. Java

-100

-80

-60

-40

-20

0

20

40

-18

Node.js Performance

(Compared to Java)

JSON SerializationSingle QueryMultiple Queries

%ag

e of

Jav

a P

erfo

rman

ce

Page 60: InterConnect2016: WebApp Architectures with Java and Node.js

60

Node.js Web App Performance vs. Java

-100

-80

-60

-40

-20

0

20

4028

Node.js Performance

(Compared to Java)

JSON SerializationSingle QueryMultiple QueriesData Updates

%ag

e of

Jav

a P

erfo

rman

ce

Page 61: InterConnect2016: WebApp Architectures with Java and Node.js

61

Node.js Web App Performance vs. Java

-100

-80

-60

-40

-20

0

20

4028

Node.js Performance

(Compared to Java)

JSON SerializationSingle QueryMultiple QueriesData Updates

%ag

e of

Jav

a P

erfo

rman

ce

More Computation

More I/O

Page 62: InterConnect2016: WebApp Architectures with Java and Node.js

6217*IBM created open sourced benchmark, being considered for endorsement by Node Foundation

Node.js Web App Performance

• Results from Acme Air*: − Flight booking benchmark that includes large I/O component − https://github.com/acmeair/acmeair

Page 63: InterConnect2016: WebApp Architectures with Java and Node.js

63

● JIT Compilers thrive on certainty ● Allows functions to be implemented as efficiently as possible

● Dynamic typing forces the JIT to do more work: ● Variables could be function, or data ● Variables must be tested to determine how to handle them ● Variable types can change over time

Variable Typing and Just-In-Time (JIT) Compilation

Page 64: InterConnect2016: WebApp Architectures with Java and Node.js

64

Just-In-Time (JIT) Compilation: The ‘+’ operator

int add(int a, int b) { return (a + b); }

Page 65: InterConnect2016: WebApp Architectures with Java and Node.js

65

Just-In-Time (JIT) Compilation: The ‘+’ operator

int add(int a, int b) { return (a + b); }

Add Instruction

Page 66: InterConnect2016: WebApp Architectures with Java and Node.js

66

Just-In-Time (JIT) Compilation: The ‘+’ operator

int add(int a, int b) { return (a + b); }

Add Instruction

Return Result

Page 67: InterConnect2016: WebApp Architectures with Java and Node.js

67

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Page 68: InterConnect2016: WebApp Architectures with Java and Node.js

68

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

A

Page 69: InterConnect2016: WebApp Architectures with Java and Node.js

69

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString Number

Page 70: InterConnect2016: WebApp Architectures with Java and Node.js

70

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Page 71: InterConnect2016: WebApp Architectures with Java and Node.js

71

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Page 72: InterConnect2016: WebApp Architectures with Java and Node.js

72

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

Page 73: InterConnect2016: WebApp Architectures with Java and Node.js

73

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

StringCheck type of

B

Num

ber

Page 74: InterConnect2016: WebApp Architectures with Java and Node.js

74

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

StringCheck type of

B

Num

ber

Concatenate

Page 75: InterConnect2016: WebApp Architectures with Java and Node.js

75

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

StringCheck type of

B

Num

ber

Concatenate

Floating Point orNormal

NormalFloat

Page 76: InterConnect2016: WebApp Architectures with Java and Node.js

76

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

StringCheck type of

B

Num

ber

Concatenate

Floating Point orNormal

NormalFloat Add Instruction

Page 77: InterConnect2016: WebApp Architectures with Java and Node.js

77

Just-In-Time (JIT) Compilation: The ‘+’ operator

var add = function (a, b) { return (a + b); }

Check type of

AString NumberString

Check type of

B

Num

ber

Concatenate

Concatenate

StringCheck type of

B

Num

ber

Concatenate

Floating Point orNormal

NormalFloat Add InstructionFloat Calculation

Page 78: InterConnect2016: WebApp Architectures with Java and Node.js

78

Dynamically vs. Statically Typed Languages

-70

-60

-50

-40

-30

-20

-10

0

Dynamic vs Statically Typed Language Performance

JSONSingleMultiUpdates

Bes

t dyn

amic

com

pare

d to

bes

t sta

tic a

s ba

selin

e

● Best statically typed language much better than best dynamic

Page 79: InterConnect2016: WebApp Architectures with Java and Node.js

79

Language Selection

Page 80: InterConnect2016: WebApp Architectures with Java and Node.js

80

“Do one thing, and do it well”

● Services are small and targeted to their task ● Services are organized around capabilities ● Services are self contained, storing their own data

Microservices Paradigm

Page 81: InterConnect2016: WebApp Architectures with Java and Node.js

81

Choosing the Right Language for the Service

Page 82: InterConnect2016: WebApp Architectures with Java and Node.js

82

Choosing the Right Language for the Service

0

500

1000

1500

2000

2500

3000

regex-dna

n-body

binary-trees

spectral-norm

fannkuch-redux

reverse-compliment

k-nucleo>de

fasta

VolumeofCod

e

Node.js

Java

Page 83: InterConnect2016: WebApp Architectures with Java and Node.js

83

Node.js

0

- 4x

+ 1/3x

Nod

e.js

Per

form

ance

Rel

ativ

e to

Jav

a

CPU Bound I/O Bound

* based on TechEmpower benchmark results

Application Performance (higher is better)

Choosing the Right Language for the Service

0

500

1000

1500

2000

2500

3000

regex-dna

n-body

binary-trees

spectral-norm

fannkuch-redux

reverse-compliment

k-nucleo>de

fasta

VolumeofCod

e

Node.js

Java

Page 84: InterConnect2016: WebApp Architectures with Java and Node.js

84

Node.js

0

- 4x

+ 1/3x

Nod

e.js

Per

form

ance

Rel

ativ

e to

Jav

a

CPU Bound I/O Bound

* based on TechEmpower benchmark results

Application Performance (higher is better)

Choosing the Right Language for the Service

0

500

1000

1500

2000

2500

3000

regex-dna

n-body

binary-trees

spectral-norm

fannkuch-redux

reverse-compliment

k-nucleo>de

fasta

VolumeofCod

e

Node.js

Java

Error: incompatible types ClassCastException

Page 85: InterConnect2016: WebApp Architectures with Java and Node.js

85

● Higher performance for I/O ● Easier async programming ● Fullstack/isomorphic development

Choosing the Right Language for the Service

Page 86: InterConnect2016: WebApp Architectures with Java and Node.js

86

Choosing the Right Language for the Service

● Higher processing performance ● Type safety for calculations ● Rich processing frameworks

Page 87: InterConnect2016: WebApp Architectures with Java and Node.js

87

● Highly performant, scalable rich web applications ● Highly performant, reliable transaction processing ● Self-contained micro-service components

Choosing the Right Language for the Service

+

Page 88: InterConnect2016: WebApp Architectures with Java and Node.js

88

EmergingArchitectures

Page 89: InterConnect2016: WebApp Architectures with Java and Node.js

89

Rich Web Applications

Page 90: InterConnect2016: WebApp Architectures with Java and Node.js

90

Rich Web Applications

Page 91: InterConnect2016: WebApp Architectures with Java and Node.js

91

Rich Web Applications

HTTP

Page 92: InterConnect2016: WebApp Architectures with Java and Node.js

92

Rich Web Applications

HTTP

Load

Bal

ance

r

Page 93: InterConnect2016: WebApp Architectures with Java and Node.js

93

Rich Web Applications

HTTP

Load

Bal

ance

r

Page 94: InterConnect2016: WebApp Architectures with Java and Node.js

94

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

Rich Web Applications

Page 95: InterConnect2016: WebApp Architectures with Java and Node.js

95

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

Rich Web Applications

Page 96: InterConnect2016: WebApp Architectures with Java and Node.js

96

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

Rich Web Applications

Page 97: InterConnect2016: WebApp Architectures with Java and Node.js

97

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

Rich Web Applications

Load

Bal

ance

r

Page 98: InterConnect2016: WebApp Architectures with Java and Node.js

98

MicroServices and API Economy

Page 99: InterConnect2016: WebApp Architectures with Java and Node.js

99

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Load

Bal

ance

r

Page 100: InterConnect2016: WebApp Architectures with Java and Node.js

100

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Load

Bal

ance

r

Page 101: InterConnect2016: WebApp Architectures with Java and Node.js

101

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Load

Bal

ance

r

Page 102: InterConnect2016: WebApp Architectures with Java and Node.js

102

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Load

Bal

ance

r

Page 103: InterConnect2016: WebApp Architectures with Java and Node.js

103

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Page 104: InterConnect2016: WebApp Architectures with Java and Node.js

104

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Page 105: InterConnect2016: WebApp Architectures with Java and Node.js

105

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Page 106: InterConnect2016: WebApp Architectures with Java and Node.js

106

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Page 107: InterConnect2016: WebApp Architectures with Java and Node.js

107

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Page 108: InterConnect2016: WebApp Architectures with Java and Node.js

108

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Page 109: InterConnect2016: WebApp Architectures with Java and Node.js

109

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Client

Page 110: InterConnect2016: WebApp Architectures with Java and Node.js

110

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Services

Client

Delivery

Page 111: InterConnect2016: WebApp Architectures with Java and Node.js

111

Operations and Management

Admin Analytics

Load

Bal

ance

r

HTTP

MicroServices and API Economy

Client

DeliveryAggregation

Services

Page 112: InterConnect2016: WebApp Architectures with Java and Node.js

112

Questions?

Page 113: InterConnect2016: WebApp Architectures with Java and Node.js

Notices and Disclaimers

113

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

Page 114: InterConnect2016: WebApp Architectures with Java and Node.js

Notices and Disclaimers Con’t.

114

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 h erein 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.

Page 115: InterConnect2016: WebApp Architectures with Java and Node.js

Thank YouYour Feedback is Important!

Access the InterConnect 2016 Conference Attendee Portal to complete your session surveys from your

smartphone, laptop or conference kiosk.