SlideShare a Scribd company logo
1 of 19
Download to read offline
Server-Side JavaScript
with Nashorn
Dan Woods
@danveloper
About Me
Author for InfoQ /danveloper
danielpwoods@gmail.com
Intro
My Experiences with PhotoZero!
!
• A client-side file encryption service
!
• Allowed clients to security unlock files/photos with
confidence
!
• Server never knew about the content or password
that a user was uploading, only its chunks in the
position
!
• Salted unlock keys were encrypted to double-down
on security
File
Intro
General PhotoZero Overview
Chunks
PZERO
Chunking
Engine
Chunk
Chunk
Chunk
Chunk
Server
Encryptor
Encryptor
Encryptor
Encryptor
DB
Backgrounding: https://github.com/danveloper/jquery-bqep-plugin
Intro
PhotoZero & How I came to Server-Side
JavaScript!
!
• Client entirely in HTML5 JavaScript
!
• Decorated with JQuery (some good, mostly bad)
!
• Server-side was implemented on the JVM (Grails)
!
• Non-common language between front-end and
back-end didn’t feel right
Intro
Rhino!
!
• Started by Netscape in 1997
!
• Originally designed as Netscape’s (ahem…)
Javagator
!
• Code generation, memory leaks, slow compilation
times
Intro
What is Nashorn?!
!
• The Better-than-Rhino JVM JavaScript Engine
!
• Comes out-of-the-box with Java 8 and above
!
• Replacement for Rhino
Intro
The Need for Nashorn!
!
• JVM is a polyglot platform
!
• Rhino is old
!
• Comparatively, Rhino is quite slow
!
• ECMAScript compliance
Intro
The How of Nashorn!
!
• Truly practical JavaScript on the JVM was not
possible until Java 7
!
• Java 7’s invokeDynamic gives static linking to
dynamic languages (incl. JavaScript)
!
• JVM dynamic languages have runtime support in
method dispatching, without runtime costs
Engine Features
Nashorn Features!
!
• 100% ECMAScript 5.1 compliance
!
• Support for a few extensions
• function expression closures - Mozilla 1.8,
• for-each expressions - Mozilla 1.6,
• Rhino constructor extensions
!
• Powerful CLI (jjs) for building command-line scripts!
Use Cases
Avatar.js and node.jar!
!
• Avatar is a web framework that brings Node-style
syntax and programming to the JVM
!
• Written by Oracle as a code-gen’d bridge to HTML5
apps
!
• Event-driven support for html web server, SSE
spec, websockets
Use Cases
Avatar.js and node.jar!
!
• Respects your Node modules paths, so you can
npm install in the same way
!
• Note: v8 and Nashorn have different ideas about
what the Error class does… I’ve built a “fix”
Use Cases
Java Interoperability!
!
• Java has a great modularity story, and its ability to
compose libraries is a huge value to JavaScript
!
• Java has a long history and has figured out
solutions to a lot of the problems of server-side
development
!
• Nashorn’s dynamic linking brings performance with
interoperability; JavaScript methods can be
seamlessly linked and vice-versa
Use Cases
What has Java Done Right?!
!
• For better or worse: databases and persistence
!
• Threads; we can’t just ignore these things! They’re
useful!
!
• Right Tool For The Job (tm) — JVM languages
!
• Embedded systems
!
• Build systems (Maven, Gradle, SBT, Ant, etc…)
Use Cases
Why Should I Care?!
!
• This platform of interop allows you to use best-of-
breed for the job
!
• Gives you an avenue to refactor existing code to
more sensible JavaScript
!
• Garner all the tooling and monitoring of JMX and
Java instrumentation
Use Cases
Server Side Scripting!
!
• Nashorn ships with a script runner (jjs)
!
• Allows server scripts to be written with JavaScript
!
• Special syntax for falling back to shell, and ability to
capture that output (very Perl-like)
Use Cases
Performance!
!
• Java 8 introduced practical JavaScript on the JVM
!
• Performance & Compliance is at the forefront, but
the former is still not quite there
!
• The near-term roadmap for the JVM brings
performance enhancements to Nashorn
Performance
Performance!
!
• Soon, JavaScript on the JVM will run at near-native
performance levels!
!
• This update will come as part of Java 8u40
The Future
The Future…!
!
• Nashorn will make the JVM a platform for
performant dynamic languages, targeting native-
like performance
!
• Java 8 will continue to improve upon JavaScript’s
server-side performance, and will offer other
languages the same performance

More Related Content

What's hot

9 anti-patterns for node.js teams
9 anti-patterns for node.js teams9 anti-patterns for node.js teams
9 anti-patterns for node.js teamsJeff Harrell
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmSkills Matter
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
Node.js in a heterogeneous system
Node.js in a heterogeneous systemNode.js in a heterogeneous system
Node.js in a heterogeneous systemGeeksLab Odessa
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Christian Joudrey
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaNurul Ferdous
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsGary Yeh
 
Webアプリケーションとメモリ
WebアプリケーションとメモリWebアプリケーションとメモリ
WebアプリケーションとメモリMasahiro Nagano
 
Server::Starter meets Java
Server::Starter meets JavaServer::Starter meets Java
Server::Starter meets JavaTokuhiro Matsuno
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystemYukti Kaura
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAdler Hsieh
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java Worldirbull
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Oscar Renalias
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ TokopediaQasim Zaidi
 
Lagergren jvmls-2013-final
Lagergren jvmls-2013-finalLagergren jvmls-2013-final
Lagergren jvmls-2013-finalMarcus Lagergren
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Edureka!
 

What's hot (20)

Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
9 anti-patterns for node.js teams
9 anti-patterns for node.js teams9 anti-patterns for node.js teams
9 anti-patterns for node.js teams
 
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvmScala e xchange 2013 haoyi li on metascala a tiny diy jvm
Scala e xchange 2013 haoyi li on metascala a tiny diy jvm
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js in a heterogeneous system
Node.js in a heterogeneous systemNode.js in a heterogeneous system
Node.js in a heterogeneous system
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
 
Basic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.jsBasic Understanding and Implement of Node.js
Basic Understanding and Implement of Node.js
 
Webアプリケーションとメモリ
WebアプリケーションとメモリWebアプリケーションとメモリ
Webアプリケーションとメモリ
 
Server::Starter meets Java
Server::Starter meets JavaServer::Starter meets Java
Server::Starter meets Java
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js for beginner
Node.js for beginnerNode.js for beginner
Node.js for beginner
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 TaiwanAutomating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
Automating Your Daily Tasks with Scripting - RubyConf 2015 Taiwan
 
Running JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java WorldRunning JavaScript Efficiently in a Java World
Running JavaScript Efficiently in a Java World
 
Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013Node.js, for architects - OpenSlava 2013
Node.js, for architects - OpenSlava 2013
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ Tokopedia
 
Lagergren jvmls-2013-final
Lagergren jvmls-2013-finalLagergren jvmls-2013-final
Lagergren jvmls-2013-final
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 

Viewers also liked

A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9Marcus Lagergren
 
Framtidens ehandel redan idag
Framtidens ehandel redan idagFramtidens ehandel redan idag
Framtidens ehandel redan idagUlrika Schreil
 
9no a 2da version
9no a 2da version9no a 2da version
9no a 2da versionAna María
 
Introducción a la CMNUCC
Introducción a la CMNUCCIntroducción a la CMNUCC
Introducción a la CMNUCCCO2.cr
 
Professional scepticism judgment uia 2
Professional scepticism judgment uia 2Professional scepticism judgment uia 2
Professional scepticism judgment uia 2Nik Hasyudeen
 
Convertible Leasing Guide
Convertible Leasing GuideConvertible Leasing Guide
Convertible Leasing GuideSwapaLease.com
 
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. Мукачево
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. МукачевоСвято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. Мукачево
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. МукачевоНаталія Бабич
 
Evolucion de la informatica y su aplicacion
Evolucion de la informatica y su aplicacionEvolucion de la informatica y su aplicacion
Evolucion de la informatica y su aplicacionJessy Acosta
 
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCA
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCAINTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCA
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCAAdriana Amo
 
Introducción a la Biotecnología. Capítulo 2
Introducción a la Biotecnología. Capítulo 2Introducción a la Biotecnología. Capítulo 2
Introducción a la Biotecnología. Capítulo 2CiberGeneticaUNAM
 
Introducción a la cerámica popular canaria cuadernillo
Introducción a la cerámica popular canaria cuadernilloIntroducción a la cerámica popular canaria cuadernillo
Introducción a la cerámica popular canaria cuadernilloGustavo Rivero Vega
 
Worcester Food & Active Living Policy Council: An Introduction
Worcester Food & Active Living Policy Council: An IntroductionWorcester Food & Active Living Policy Council: An Introduction
Worcester Food & Active Living Policy Council: An Introductionesheehancastro
 
Introducción a la ciencia e ingeniería de los materiales william d. callist...
Introducción a la ciencia e ingeniería de los materiales   william d. callist...Introducción a la ciencia e ingeniería de los materiales   william d. callist...
Introducción a la ciencia e ingeniería de los materiales william d. callist...elkinn
 
8th pre alg -jan22
8th pre alg -jan228th pre alg -jan22
8th pre alg -jan22jdurst65
 
IntroduccióN A La ClíNica PsicolóGica Con NiñOs
IntroduccióN A La ClíNica PsicolóGica  Con  NiñOsIntroduccióN A La ClíNica PsicolóGica  Con  NiñOs
IntroduccióN A La ClíNica PsicolóGica Con NiñOsguesta14865ae
 

Viewers also liked (20)

A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9A new execution model for Nashorn in Java 9
A new execution model for Nashorn in Java 9
 
진큐 오버뷰
진큐 오버뷰진큐 오버뷰
진큐 오버뷰
 
Framtidens ehandel redan idag
Framtidens ehandel redan idagFramtidens ehandel redan idag
Framtidens ehandel redan idag
 
9no a 2da version
9no a 2da version9no a 2da version
9no a 2da version
 
Weekly plannig52012
Weekly plannig52012Weekly plannig52012
Weekly plannig52012
 
Aнглийский сленг (U-Z)
Aнглийский сленг (U-Z)Aнглийский сленг (U-Z)
Aнглийский сленг (U-Z)
 
Introducción a la CMNUCC
Introducción a la CMNUCCIntroducción a la CMNUCC
Introducción a la CMNUCC
 
Professional scepticism judgment uia 2
Professional scepticism judgment uia 2Professional scepticism judgment uia 2
Professional scepticism judgment uia 2
 
Convertible Leasing Guide
Convertible Leasing GuideConvertible Leasing Guide
Convertible Leasing Guide
 
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. Мукачево
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. МукачевоСвято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. Мукачево
Свято 8 Березня в середній групі "Ромашка" ДНЗ № 28 м. Мукачево
 
Evolucion de la informatica y su aplicacion
Evolucion de la informatica y su aplicacionEvolucion de la informatica y su aplicacion
Evolucion de la informatica y su aplicacion
 
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCA
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCAINTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCA
INTRODUCCIÓN A LA COMUNICACIÓN CIENTIFÍCA
 
Introducción a la Biotecnología. Capítulo 2
Introducción a la Biotecnología. Capítulo 2Introducción a la Biotecnología. Capítulo 2
Introducción a la Biotecnología. Capítulo 2
 
Introducción a la cerámica popular canaria cuadernillo
Introducción a la cerámica popular canaria cuadernilloIntroducción a la cerámica popular canaria cuadernillo
Introducción a la cerámica popular canaria cuadernillo
 
Worcester Food & Active Living Policy Council: An Introduction
Worcester Food & Active Living Policy Council: An IntroductionWorcester Food & Active Living Policy Council: An Introduction
Worcester Food & Active Living Policy Council: An Introduction
 
Guitar 5th grade
Guitar 5th gradeGuitar 5th grade
Guitar 5th grade
 
Introducción a la ciencia e ingeniería de los materiales william d. callist...
Introducción a la ciencia e ingeniería de los materiales   william d. callist...Introducción a la ciencia e ingeniería de los materiales   william d. callist...
Introducción a la ciencia e ingeniería de los materiales william d. callist...
 
8th pre alg -jan22
8th pre alg -jan228th pre alg -jan22
8th pre alg -jan22
 
IntroduccióN A La ClíNica PsicolóGica Con NiñOs
IntroduccióN A La ClíNica PsicolóGica  Con  NiñOsIntroduccióN A La ClíNica PsicolóGica  Con  NiñOs
IntroduccióN A La ClíNica PsicolóGica Con NiñOs
 
Innovation in digital schools Gess Dubai 2013
Innovation in digital schools Gess Dubai 2013Innovation in digital schools Gess Dubai 2013
Innovation in digital schools Gess Dubai 2013
 

Similar to Server-Side JavaScript with Nashorn

T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJSTim Sommer
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteChristian Heilmann
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matterTomas Doran
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)daylerees
 
The JavaScript Delusion
The JavaScript DelusionThe JavaScript Delusion
The JavaScript DelusionJUGBD
 
General Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptGeneral Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptSpike Brehm
 
Usersnap and the javascript magic behind the scenes - ViennaJS
Usersnap and the javascript magic behind the scenes - ViennaJSUsersnap and the javascript magic behind the scenes - ViennaJS
Usersnap and the javascript magic behind the scenes - ViennaJSUsersnap
 
Continuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSContinuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSDaniel Woods
 
Basic javaprogramming(session1)
Basic javaprogramming(session1)Basic javaprogramming(session1)
Basic javaprogramming(session1)Barm Bannasan
 
JavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefoxJavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefoxGennady Feldman
 
BP-9 Share Customization Best Practices
BP-9 Share Customization Best PracticesBP-9 Share Customization Best Practices
BP-9 Share Customization Best PracticesAlfresco Software
 
Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date. Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date. Christian Heilmann
 

Similar to Server-Side JavaScript with Nashorn (20)

T4T Training day - NodeJS
T4T Training day - NodeJST4T Training day - NodeJS
T4T Training day - NodeJS
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
 
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
An Introduction to the Laravel Framework (AFUP Forum PHP 2014)
 
The JavaScript Delusion
The JavaScript DelusionThe JavaScript Delusion
The JavaScript Delusion
 
General Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScriptGeneral Assembly Workshop: Advanced JavaScript
General Assembly Workshop: Advanced JavaScript
 
Usersnap and the javascript magic behind the scenes - ViennaJS
Usersnap and the javascript magic behind the scenes - ViennaJSUsersnap and the javascript magic behind the scenes - ViennaJS
Usersnap and the javascript magic behind the scenes - ViennaJS
 
Continuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSSContinuous Delivery with NetflixOSS
Continuous Delivery with NetflixOSS
 
Java (1)
Java (1)Java (1)
Java (1)
 
Basic javaprogramming(session1)
Basic javaprogramming(session1)Basic javaprogramming(session1)
Basic javaprogramming(session1)
 
JavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefoxJavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefox
 
BP-9 Share Customization Best Practices
BP-9 Share Customization Best PracticesBP-9 Share Customization Best Practices
BP-9 Share Customization Best Practices
 
Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date. Let’s learn how to use JavaScript responsibly and stay up-to-date.
Let’s learn how to use JavaScript responsibly and stay up-to-date.
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
Core Java
Core JavaCore Java
Core Java
 
Curso de Programación Java Intermedio
Curso de Programación Java IntermedioCurso de Programación Java Intermedio
Curso de Programación Java Intermedio
 
java completed units.docx
java completed units.docxjava completed units.docx
java completed units.docx
 
java full 1.docx
java full 1.docxjava full 1.docx
java full 1.docx
 
java full.docx
java full.docxjava full.docx
java full.docx
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 

More from Daniel Woods

Continuous Delivery with Spinnaker and OpenStack
Continuous Delivery with Spinnaker and OpenStackContinuous Delivery with Spinnaker and OpenStack
Continuous Delivery with Spinnaker and OpenStackDaniel Woods
 
High Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootHigh Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootDaniel Woods
 
Groovy in the Cloud
Groovy in the CloudGroovy in the Cloud
Groovy in the CloudDaniel Woods
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Daniel Woods
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web FrameworkDaniel Woods
 
Microservices: The Right Way
Microservices: The Right WayMicroservices: The Right Way
Microservices: The Right WayDaniel Woods
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web FrameworkDaniel Woods
 
Facilitating Continuous Delivery at Scale
Facilitating Continuous Delivery at ScaleFacilitating Continuous Delivery at Scale
Facilitating Continuous Delivery at ScaleDaniel Woods
 
Groovy for System Administrators
Groovy for System AdministratorsGroovy for System Administrators
Groovy for System AdministratorsDaniel Woods
 
Message Driven Architecture in Grails
Message Driven Architecture in GrailsMessage Driven Architecture in Grails
Message Driven Architecture in GrailsDaniel Woods
 
Building Web Apps in Ratpack
Building Web Apps in RatpackBuilding Web Apps in Ratpack
Building Web Apps in RatpackDaniel Woods
 
Gainesville Web Developer Group, Sept 2012
Gainesville Web Developer Group, Sept 2012Gainesville Web Developer Group, Sept 2012
Gainesville Web Developer Group, Sept 2012Daniel Woods
 

More from Daniel Woods (13)

Continuous Delivery with Spinnaker and OpenStack
Continuous Delivery with Spinnaker and OpenStackContinuous Delivery with Spinnaker and OpenStack
Continuous Delivery with Spinnaker and OpenStack
 
High Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring BootHigh Performance Microservices with Ratpack and Spring Boot
High Performance Microservices with Ratpack and Spring Boot
 
Groovy in the Cloud
Groovy in the CloudGroovy in the Cloud
Groovy in the Cloud
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web Framework
 
Microservices: The Right Way
Microservices: The Right WayMicroservices: The Right Way
Microservices: The Right Way
 
Ratpack Web Framework
Ratpack Web FrameworkRatpack Web Framework
Ratpack Web Framework
 
Facilitating Continuous Delivery at Scale
Facilitating Continuous Delivery at ScaleFacilitating Continuous Delivery at Scale
Facilitating Continuous Delivery at Scale
 
Future of Grails
Future of GrailsFuture of Grails
Future of Grails
 
Groovy for System Administrators
Groovy for System AdministratorsGroovy for System Administrators
Groovy for System Administrators
 
Message Driven Architecture in Grails
Message Driven Architecture in GrailsMessage Driven Architecture in Grails
Message Driven Architecture in Grails
 
Building Web Apps in Ratpack
Building Web Apps in RatpackBuilding Web Apps in Ratpack
Building Web Apps in Ratpack
 
Gainesville Web Developer Group, Sept 2012
Gainesville Web Developer Group, Sept 2012Gainesville Web Developer Group, Sept 2012
Gainesville Web Developer Group, Sept 2012
 

Recently uploaded

Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsMonica Sydney
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...meghakumariji156
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.krishnachandrapal52
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsPriya Reddy
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...kajalverma014
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查ydyuyu
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfJOHNBEBONYAP1
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsMonica Sydney
 

Recently uploaded (20)

Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls in Anand Vihar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
Tadepalligudem Escorts Service Girl ^ 9332606886, WhatsApp Anytime Tadepallig...
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdfpdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
pdfcoffee.com_business-ethics-q3m7-pdf-free.pdf
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Call girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girlsCall girls Service in Ajman 0505086370 Ajman call girls
Call girls Service in Ajman 0505086370 Ajman call girls
 

Server-Side JavaScript with Nashorn

  • 2. About Me Author for InfoQ /danveloper danielpwoods@gmail.com
  • 3. Intro My Experiences with PhotoZero! ! • A client-side file encryption service ! • Allowed clients to security unlock files/photos with confidence ! • Server never knew about the content or password that a user was uploading, only its chunks in the position ! • Salted unlock keys were encrypted to double-down on security
  • 5. Intro PhotoZero & How I came to Server-Side JavaScript! ! • Client entirely in HTML5 JavaScript ! • Decorated with JQuery (some good, mostly bad) ! • Server-side was implemented on the JVM (Grails) ! • Non-common language between front-end and back-end didn’t feel right
  • 6. Intro Rhino! ! • Started by Netscape in 1997 ! • Originally designed as Netscape’s (ahem…) Javagator ! • Code generation, memory leaks, slow compilation times
  • 7. Intro What is Nashorn?! ! • The Better-than-Rhino JVM JavaScript Engine ! • Comes out-of-the-box with Java 8 and above ! • Replacement for Rhino
  • 8. Intro The Need for Nashorn! ! • JVM is a polyglot platform ! • Rhino is old ! • Comparatively, Rhino is quite slow ! • ECMAScript compliance
  • 9. Intro The How of Nashorn! ! • Truly practical JavaScript on the JVM was not possible until Java 7 ! • Java 7’s invokeDynamic gives static linking to dynamic languages (incl. JavaScript) ! • JVM dynamic languages have runtime support in method dispatching, without runtime costs
  • 10. Engine Features Nashorn Features! ! • 100% ECMAScript 5.1 compliance ! • Support for a few extensions • function expression closures - Mozilla 1.8, • for-each expressions - Mozilla 1.6, • Rhino constructor extensions ! • Powerful CLI (jjs) for building command-line scripts!
  • 11. Use Cases Avatar.js and node.jar! ! • Avatar is a web framework that brings Node-style syntax and programming to the JVM ! • Written by Oracle as a code-gen’d bridge to HTML5 apps ! • Event-driven support for html web server, SSE spec, websockets
  • 12. Use Cases Avatar.js and node.jar! ! • Respects your Node modules paths, so you can npm install in the same way ! • Note: v8 and Nashorn have different ideas about what the Error class does… I’ve built a “fix”
  • 13. Use Cases Java Interoperability! ! • Java has a great modularity story, and its ability to compose libraries is a huge value to JavaScript ! • Java has a long history and has figured out solutions to a lot of the problems of server-side development ! • Nashorn’s dynamic linking brings performance with interoperability; JavaScript methods can be seamlessly linked and vice-versa
  • 14. Use Cases What has Java Done Right?! ! • For better or worse: databases and persistence ! • Threads; we can’t just ignore these things! They’re useful! ! • Right Tool For The Job (tm) — JVM languages ! • Embedded systems ! • Build systems (Maven, Gradle, SBT, Ant, etc…)
  • 15. Use Cases Why Should I Care?! ! • This platform of interop allows you to use best-of- breed for the job ! • Gives you an avenue to refactor existing code to more sensible JavaScript ! • Garner all the tooling and monitoring of JMX and Java instrumentation
  • 16. Use Cases Server Side Scripting! ! • Nashorn ships with a script runner (jjs) ! • Allows server scripts to be written with JavaScript ! • Special syntax for falling back to shell, and ability to capture that output (very Perl-like)
  • 17. Use Cases Performance! ! • Java 8 introduced practical JavaScript on the JVM ! • Performance & Compliance is at the forefront, but the former is still not quite there ! • The near-term roadmap for the JVM brings performance enhancements to Nashorn
  • 18. Performance Performance! ! • Soon, JavaScript on the JVM will run at near-native performance levels! ! • This update will come as part of Java 8u40
  • 19. The Future The Future…! ! • Nashorn will make the JVM a platform for performant dynamic languages, targeting native- like performance ! • Java 8 will continue to improve upon JavaScript’s server-side performance, and will offer other languages the same performance