23
Simplicity meets Scalability (JavaScript on Java Servers) Ing. Rolando Santamaría Masó Software Architect at Innotrade GmbH Herzogenrath, Germany Code.Talks Conference 2015 September 29, 2015 Dammtordamm 1, 20354 Hamburg

Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Embed Size (px)

Citation preview

Page 1: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Simplicity meets Scalability(JavaScript on Java Servers)

Ing. Rolando Santamaría MasóSoftware Architect at Innotrade GmbHHerzogenrath, Germany

Code.Talks Conference 2015September 29, 2015

Dammtordamm 1, 20354 Hamburg

Page 2: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Who am I?

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 2

• Software developer and architect • Started in the PHP world ;)

• jWebSocket framework core team from 2010 • Java, JavaScript• HTTP - WebSockets• High performance I/O• APIs

• Informatic Sciences Engineer (UCI, Cuba)• Software Architect at Innotrade GmbH from 2014

Page 3: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Today's session

• Agenda:• Java and JavaScript in 2015.

• High Performance Clusters with jWebSocket.

• Creating JavaScript applications with jWebSocket (Scripting plug-in):

- General concepts.- Getting started.

- The notebook app demo.

• Questions and suggestions.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 3

Page 4: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015

Java on TIOBE Indexhttp://www.tiobe.com/index.php/content/paperinfo/tpci/index.html (September 2015)

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 4

Page 5: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015

Java on TIOBE Indexhttp://www.tiobe.com/index.php/content/paperinfo/tpci/index.html (September 2015)

Ebay, Amazon, Google, Netflix, Linkedin

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 5

Page 6: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 6

Page 7: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Must used JavaScript engines for the JVM (JSR-223):

Rhino Nashorn

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 7

Page 8: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Nashorn: The New Rhino on the Blockhttp://ariya.ofilabs.com/2014/03/nashorn-the-new-rhino-on-the-block.html

Performance comparison between Rhino, Nashorn and Google V8 engines:

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 8

Page 9: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Inside Vert.x. Comparison with Node.jshttp://www.cubrid.org/blog/dev-platform/inside-vertx-comparison-with-nodejs/

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 9

Page 10: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Inside Vert.x. Comparison with Node.jshttp://www.cubrid.org/blog/dev-platform/inside-vertx-comparison-with-nodejs/

Here the bigger is better ;)

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 10

Page 11: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

Nashorn: The New Rhino on the Blockhttp://ariya.ofilabs.com/2014/03/nashorn-the-new-rhino-on-the-block.html

Performance comparison between Rhino, Nashorn and Google V8 engines:

Nashorn provides the fastest

JavaScript RTE for the JVM.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 11

Page 12: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Java and JavaScript in 2015 (Nashorn)

JSR-223 (Nashorn: ECMA-262 and ECMAScript 5.1)

ScriptEngineManager manager = new ScriptEngineManager();ScriptEngine engine = manager.getEngineByName("JavaScript");

File f = new File("test.txt");engine.put("file", f);

engine.eval("print(file.getAbsolutePath())");

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 12

Page 13: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

The highly scalable real-time web applications development framework.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 13

Page 14: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

• Why app clusters are required?

• Scalability

• High Availability

• High Performance• System load is distributed, parallelized when possible.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 14

Page 15: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

• Why app clusters are required?

• Scalability

• High Availability

• High Performance• System load is distributed, parallelized when possible.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 15

Critical enterprise apps require

clusters.

Page 16: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

• The jWebSocket approach for WebSocket clients

wss://

Nginxinstances

as

load balancer

ActiveMQcluster

as message broker

ws://

https://

http://

Nginxinstances

as web server

MongoDBcluster

as shared data

tcp://

jWebSocketinstances

as application nodes

tcp://tcp://

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 16

Page 17: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

• The jWebSocket approach for WebSocket clients

wss://

Nginxinstances

as

load balancer

ActiveMQcluster

as message broker

ws://

https://

http://

Nginxinstances

as web server

MongoDBcluster

as shared data

tcp://

jWebSocketinstances

as application nodes

tcp://tcp://

jWebSocket apps can scale up

to millions of clients.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 17

Page 18: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

High Performance Clusters with jWebSocket

plus

JavaScript

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 18

Page 19: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Creating JavaScript applications with jWebSocket Scripting plug-in

General concepts:• Script apps stands on the jWebSocket communication

backbone.

• Per app security sandbox (intended for multi-tenant purposes).

• Automatic client-side App object generation (optional).

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 19

Page 20: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Creating JavaScript applications with jWebSocket Scripting plug-in

General concepts:• JavaScript apps (09/2015).

• Hot deploys and code reloads.

• NPM optional support (modules require to be Nashorn compliant).

• High level API.

• EventBus integration.

• Built-in annotations: type, not_null, max_length, min_length, min_value, max_value, default_value, regex, authenticated, authority, async.

• Custom annotation processors.

• Custom arguments validation.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 20

Page 21: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Creating JavaScript applications with jWebSocket Scripting plug-in

Live Demo:

•Create new app from the console.

•Add basic collection CRUD.

•Show HOT reload in action.

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 21

Page 22: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Creating JavaScript applications with jWebSocket Scripting plug-in

Live Demo:

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 22

Page 23: Rolando Santamaría Masó - Simplicity meets scalability - code.talks 2015

Questions and Suggestions

Questions and Suggestions?• My contact: [email protected]

@kyberneees on twitter• Website: http://jwebsocket.org• More: http://jwebsocket.org/documentation/Plug-Ins/

Scripting-Plug-In/Developer-Guide

[email protected]

Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 23