Upload
aboutyougmbh
View
338
Download
0
Embed Size (px)
Citation preview
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
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
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
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
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
Java and JavaScript in 2015 (Nashorn)
Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 6
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
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
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
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
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
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
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
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
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.
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
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
High Performance Clusters with jWebSocket
plus
JavaScript
Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 18
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
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
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
Creating JavaScript applications with jWebSocket Scripting plug-in
Live Demo:
Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 22
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
Rolando Santamaría Masó - Simplicity meets Scalability (JavaScript on Java Servers) - 23