SlideShare ist ein Scribd-Unternehmen logo
Jeremy Whitlock (@whitlockjc)
Gluecon 2014
Bringing Node.js to the JVM
Why bring Node.js to the JVM?
Use Case: Node.js API for Managing API Proxies
Use Case: Writing MapReduce Jobs With JavaScript/Node.js
Discuss why Java/Node.js interop makes sense
An introduction to the project enabling Java/Node.js interop
Let’s open source something
What this talk is about
Why do people love/hate Java?
Why do people love/hata JavaScript?
Which language is better?
(insert flame war starter here)...
We know people love/hate Java…
We know people love/hate JavaScript…
We know both languages have their pros/cons…
...
What this talk is not about
Use Cases
A while back, Apigee was looking for a simple, programmable approach for
configuring and managing API proxies. We wanted to take an XML-based
and provide an easier, programmable interface without losing what makes
our API ecosystem what it is today.
The timing around this decision was right when Walmart, LinkedIn,
eBay/PayPal and others were developing high performance, scalable REST
API libraries/tools on Node.js.
We quickly realized how well-suited Node.js was for what we were trying to
accomplish with these API proxies: highly concurrent, asynchronous
scalable servers
Where Java interop becomes important in this scenario is that our backend
is Java-based and we need some way to deploy/manage these Node.js
servers from our existing infrastructure.
Node.js API for Managing API Proxies
On the data team, we were building a data processing system around
MapReduce. When we talked to some of the PMs, we decided that we
wanted a simpler way to do this...without Java.
While we wanted a simpler approach than Java, we did not want to reinvent
the wheel and we wanted to make it easy for those with MapReduce
experience to just jump in and be productive.
JavaScript was the language we decided on because it was built into the
JVM from Java 6 onward and it was small/simple enough to learn.
While JavaScript was the language we chose to use, without Node.js we
faced problems with packaging problems, code reuse, dependencies, etc.
We decided to align with the rest of the company and use Node.js for our
data processing support.
Writing MapReduce Jobs With JavaScript/Node.
js
The Problem
To summarize the problem: We want to use Node.js in a Java world
Like or not, many of us live in a Java world: Cassandra, Hadoop, Mule,
Qpid, ...
For some Java-based tools, there are Node.js clients/ports to make
interoperability a non-issue.
But for most of the aforementioned systems, like Hadoop, this is not an
option. What do we do?
● Write a pure Node.js module? (Not always possible)
● Not use Node.js? (Not ideal)
● Not use the Java system (Hadoop, …)? (Not ideal)
The Problem
Node.js Is Bad Ass Rock Star Tech
The Solution
The best of both worlds is to figure out some way to provide interop
● This will allow code reuse between Java and Node.js
● This will require the least amount of wheel reinventing
● The time it takes to use both is invaluable
● Much less time than porting one tool/library to another language
● Much less time than waiting on someone to port it for you
How do we do we provide this interoperability between Java and Node.js?
Thankfully, this is already solved for us and the solution we chose was a
project called Trireme: https://github.com/apigee/trireme
Trireme lets us embed Node.js in the JVM, something required for both of
our use cases, and lets us share code between both languages.
The Solution
Node.js Trireme
What is Trireme?
Single-threaded event engine
Non-blocking TCP I/O
Non-blocking UDP datagrams
Timers
Non-Blocking File I/O
“Buffer” object
Module loading system
Utility modules
Third-party components
V8 JavaScript engine
OpenSSL
ZLib
Single-threaded event engine
Non-blocking TCP I/O
Non-blocking UDP datagrams
Timers
Non-Blocking File I/O
“Buffer” object
Module loading system
Utility modules
Third-party components
Rhino JavaScript engine
Java SE
Bouncy Castle (crypto, optional)
Trireme Architecture
One thread per Node.js application
Async I/O handled via NIO within that thread
Additional thread pool for blocking operations
File I/O (especially on Java 6)
DNS lookups
Replace native code from Node.js with Java alternatives
Internal modules such as “tcp_wrap,” etc.
Implement a few popular native modules with Java code
“iconv,” “node_xslt”, eventually others
Trireme lets you embed a Node.js runtime within the JVM. You have full
control over its environment.
Trireme allows you to interact with Node.js modules and JavaScript objects
from Java.
Trireme allows you to expose Java objects to JavaScript code either by
calling JavaScript directly or by exposing Java-based Node.js modules
Trireme allows you to bundle/ship JavaScript Node.js modules (This seems
trivial but imagine creating a vetted Node.js environment and shipping it with
your runtime)
Don’t believe me? Let’s look at a project that uses Trireme to allow you to
write MapReduce jobs using JavaScript/Node.js
What Does Trireme Bring to the Table
Let’s Open Source Something
Lembos provides you with a MapReduce runtime and runner that allows you
to write your MapReduce jobs using Node.js.
Jobs run in the JVM with Hadoop driving the process, as if written in Java.
Lembos provides a runner, to be ran via hadoop jar, like all other
MapReduce jobs, and a runtime that provides the bridge between the Java-
based Hadoop world and the JavaScript-based Node.js world.
The name Lembos is a play on Trireme. (A Trireme is an ancient warship
with “three banks of oars”. Since Trireme made this project possible, it
seemed fitting to have a similar name. A Lembos is a lightweight warship
typically used for piracy...not that I’m planning the same thing.)
Project Homepage: https://github.com/apigee/lembos
Introducing Lembos
Lembos Demonstration
● Trireme: https://github.com/apigee/trireme
● Lembos: https://github.com/apigee/lembos
● Anatomy of a Node.js MapReduce Job
● Lembos Architecture
● Lembos CLI Reference
● Lembos Node.js API Reference
● The Slides: http://www.slideshare.net/whitlockjc
● Contacting me:
● Twitter: @whitlockjc
● GitHub: whitlockjc
Resources
I Made It
Thank you
Gluecon 2014

Weitere ähnliche Inhalte

Was ist angesagt?

Running Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic BeanstalkRunning Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic Beanstalkzupzup.org
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystemYukti Kaura
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Node.js #digpen presentation
Node.js #digpen presentationNode.js #digpen presentation
Node.js #digpen presentationGOSS Interactive
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS Ganesh Kondal
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorialtutorialsruby
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsMichael Lange
 

Was ist angesagt? (20)

Running Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic BeanstalkRunning Containerized Node.js Services on AWS Elastic Beanstalk
Running Containerized Node.js Services on AWS Elastic Beanstalk
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
Vert.x
Vert.xVert.x
Vert.x
 
(C)NodeJS
(C)NodeJS(C)NodeJS
(C)NodeJS
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
NodeJS ecosystem
NodeJS ecosystemNodeJS ecosystem
NodeJS ecosystem
 
Nodejs
NodejsNodejs
Nodejs
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Node.js #digpen presentation
Node.js #digpen presentationNode.js #digpen presentation
Node.js #digpen presentation
 
NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Devoxx%202008%20Tutorial
Devoxx%202008%20TutorialDevoxx%202008%20Tutorial
Devoxx%202008%20Tutorial
 
Node
NodeNode
Node
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Treinamento frontend
Treinamento frontendTreinamento frontend
Treinamento frontend
 
Nodejs
NodejsNodejs
Nodejs
 
Node js projects
Node js projectsNode js projects
Node js projects
 

Andere mochten auch

Have we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpHave we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpBedis ElAchèche
 
Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)Tekno Paul
 
Soa development using javascript
Soa development using javascriptSoa development using javascript
Soa development using javascriptDsixE Inc
 
Introduccion a Nodejs
Introduccion a NodejsIntroduccion a Nodejs
Introduccion a NodejsJan Sanchez
 
Intro to the Express Web Framework
Intro to the Express Web FrameworkIntro to the Express Web Framework
Intro to the Express Web Frameworkjasonsich
 
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick TourServer-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tourq3boy
 
Being cycles of developement
Being   cycles of developementBeing   cycles of developement
Being cycles of developementManu Melwin Joy
 

Andere mochten auch (7)

Have we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUpHave we forgotten how to program? - Tunisian WebDev MeetUp
Have we forgotten how to program? - Tunisian WebDev MeetUp
 
Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)
 
Soa development using javascript
Soa development using javascriptSoa development using javascript
Soa development using javascript
 
Introduccion a Nodejs
Introduccion a NodejsIntroduccion a Nodejs
Introduccion a Nodejs
 
Intro to the Express Web Framework
Intro to the Express Web FrameworkIntro to the Express Web Framework
Intro to the Express Web Framework
 
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick TourServer-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tour
 
Being cycles of developement
Being   cycles of developementBeing   cycles of developement
Being cycles of developement
 

Ähnlich wie Gluecon 2014 - Bringing Node.js to the JVM

Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdfDarshanaMallick
 
Confoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to startConfoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to startQuentin Adam
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusUni Systems S.M.S.A.
 
Node.js rulz! JavaScript takes over the full Stack
Node.js rulz! JavaScript takes over the full StackNode.js rulz! JavaScript takes over the full Stack
Node.js rulz! JavaScript takes over the full StackAdron Hall
 
What is Node.js_ Where, When & How To Use It.pdf
What is Node.js_ Where, When & How To Use It.pdfWhat is Node.js_ Where, When & How To Use It.pdf
What is Node.js_ Where, When & How To Use It.pdfSmith Daniel
 
The Positive and Negative Aspects of Node.js Web App Development.pdf
The Positive and Negative Aspects of Node.js Web App Development.pdfThe Positive and Negative Aspects of Node.js Web App Development.pdf
The Positive and Negative Aspects of Node.js Web App Development.pdfWDP Technologies
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate
 
Node.js Web Development.pdf
Node.js Web Development.pdfNode.js Web Development.pdf
Node.js Web Development.pdfSonia Simi
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
Node.js Web Development .pdf
Node.js Web Development .pdfNode.js Web Development .pdf
Node.js Web Development .pdfAbanti Aazmin
 
Node.js vs Java: Right backend tech stack for your project
Node.js vs Java:  Right backend tech stack for your projectNode.js vs Java:  Right backend tech stack for your project
Node.js vs Java: Right backend tech stack for your projectriyak40
 
Ruby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby MeRuby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby MePanagiotis Papadopoulos
 

Ähnlich wie Gluecon 2014 - Bringing Node.js to the JVM (20)

Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Node J pdf.docx
Node J pdf.docxNode J pdf.docx
Node J pdf.docx
 
Nodejs
NodejsNodejs
Nodejs
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Node js
Node jsNode js
Node js
 
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous  Blocking or synchronous.pdfNode Js Non-blocking or asynchronous  Blocking or synchronous.pdf
Node Js Non-blocking or asynchronous Blocking or synchronous.pdf
 
Confoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to startConfoo - Javascript Server Side : How to start
Confoo - Javascript Server Side : How to start
 
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of QuarkusD. Andreadis, Red Hat: Concepts and technical overview of Quarkus
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
Node.js rulz! JavaScript takes over the full Stack
Node.js rulz! JavaScript takes over the full StackNode.js rulz! JavaScript takes over the full Stack
Node.js rulz! JavaScript takes over the full Stack
 
What is Node.js_ Where, When & How To Use It.pdf
What is Node.js_ Where, When & How To Use It.pdfWhat is Node.js_ Where, When & How To Use It.pdf
What is Node.js_ Where, When & How To Use It.pdf
 
The Positive and Negative Aspects of Node.js Web App Development.pdf
The Positive and Negative Aspects of Node.js Web App Development.pdfThe Positive and Negative Aspects of Node.js Web App Development.pdf
The Positive and Negative Aspects of Node.js Web App Development.pdf
 
Node.js.pdf
Node.js.pdfNode.js.pdf
Node.js.pdf
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect GuideKalp Corporate Node JS Perfect Guide
Kalp Corporate Node JS Perfect Guide
 
Node.js Web Development.pdf
Node.js Web Development.pdfNode.js Web Development.pdf
Node.js Web Development.pdf
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Node.js Web Development .pdf
Node.js Web Development .pdfNode.js Web Development .pdf
Node.js Web Development .pdf
 
Node.js vs Java: Right backend tech stack for your project
Node.js vs Java:  Right backend tech stack for your projectNode.js vs Java:  Right backend tech stack for your project
Node.js vs Java: Right backend tech stack for your project
 
Ruby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby MeRuby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby Me
 

Kürzlich hochgeladen

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion Clinic
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Andrea Goulet
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionWave PLM
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdfkalichargn70th171
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Soroosh Khodami
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Gáspár Nagy
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfFurqanuddin10
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationHelp Desk Migration
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabbereGrabber
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfMehmet Akar
 

Kürzlich hochgeladen (20)

5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf10 Essential Software Testing Tools You Need to Know About.pdf
10 Essential Software Testing Tools You Need to Know About.pdf
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 

Gluecon 2014 - Bringing Node.js to the JVM

  • 1. Jeremy Whitlock (@whitlockjc) Gluecon 2014 Bringing Node.js to the JVM
  • 2. Why bring Node.js to the JVM? Use Case: Node.js API for Managing API Proxies Use Case: Writing MapReduce Jobs With JavaScript/Node.js Discuss why Java/Node.js interop makes sense An introduction to the project enabling Java/Node.js interop Let’s open source something What this talk is about
  • 3. Why do people love/hate Java? Why do people love/hata JavaScript? Which language is better? (insert flame war starter here)... We know people love/hate Java… We know people love/hate JavaScript… We know both languages have their pros/cons… ... What this talk is not about
  • 5. A while back, Apigee was looking for a simple, programmable approach for configuring and managing API proxies. We wanted to take an XML-based and provide an easier, programmable interface without losing what makes our API ecosystem what it is today. The timing around this decision was right when Walmart, LinkedIn, eBay/PayPal and others were developing high performance, scalable REST API libraries/tools on Node.js. We quickly realized how well-suited Node.js was for what we were trying to accomplish with these API proxies: highly concurrent, asynchronous scalable servers Where Java interop becomes important in this scenario is that our backend is Java-based and we need some way to deploy/manage these Node.js servers from our existing infrastructure. Node.js API for Managing API Proxies
  • 6. On the data team, we were building a data processing system around MapReduce. When we talked to some of the PMs, we decided that we wanted a simpler way to do this...without Java. While we wanted a simpler approach than Java, we did not want to reinvent the wheel and we wanted to make it easy for those with MapReduce experience to just jump in and be productive. JavaScript was the language we decided on because it was built into the JVM from Java 6 onward and it was small/simple enough to learn. While JavaScript was the language we chose to use, without Node.js we faced problems with packaging problems, code reuse, dependencies, etc. We decided to align with the rest of the company and use Node.js for our data processing support. Writing MapReduce Jobs With JavaScript/Node. js
  • 8. To summarize the problem: We want to use Node.js in a Java world Like or not, many of us live in a Java world: Cassandra, Hadoop, Mule, Qpid, ... For some Java-based tools, there are Node.js clients/ports to make interoperability a non-issue. But for most of the aforementioned systems, like Hadoop, this is not an option. What do we do? ● Write a pure Node.js module? (Not always possible) ● Not use Node.js? (Not ideal) ● Not use the Java system (Hadoop, …)? (Not ideal) The Problem
  • 9. Node.js Is Bad Ass Rock Star Tech
  • 11. The best of both worlds is to figure out some way to provide interop ● This will allow code reuse between Java and Node.js ● This will require the least amount of wheel reinventing ● The time it takes to use both is invaluable ● Much less time than porting one tool/library to another language ● Much less time than waiting on someone to port it for you How do we do we provide this interoperability between Java and Node.js? Thankfully, this is already solved for us and the solution we chose was a project called Trireme: https://github.com/apigee/trireme Trireme lets us embed Node.js in the JVM, something required for both of our use cases, and lets us share code between both languages. The Solution
  • 12. Node.js Trireme What is Trireme? Single-threaded event engine Non-blocking TCP I/O Non-blocking UDP datagrams Timers Non-Blocking File I/O “Buffer” object Module loading system Utility modules Third-party components V8 JavaScript engine OpenSSL ZLib Single-threaded event engine Non-blocking TCP I/O Non-blocking UDP datagrams Timers Non-Blocking File I/O “Buffer” object Module loading system Utility modules Third-party components Rhino JavaScript engine Java SE Bouncy Castle (crypto, optional)
  • 13. Trireme Architecture One thread per Node.js application Async I/O handled via NIO within that thread Additional thread pool for blocking operations File I/O (especially on Java 6) DNS lookups Replace native code from Node.js with Java alternatives Internal modules such as “tcp_wrap,” etc. Implement a few popular native modules with Java code “iconv,” “node_xslt”, eventually others
  • 14. Trireme lets you embed a Node.js runtime within the JVM. You have full control over its environment. Trireme allows you to interact with Node.js modules and JavaScript objects from Java. Trireme allows you to expose Java objects to JavaScript code either by calling JavaScript directly or by exposing Java-based Node.js modules Trireme allows you to bundle/ship JavaScript Node.js modules (This seems trivial but imagine creating a vetted Node.js environment and shipping it with your runtime) Don’t believe me? Let’s look at a project that uses Trireme to allow you to write MapReduce jobs using JavaScript/Node.js What Does Trireme Bring to the Table
  • 15. Let’s Open Source Something
  • 16. Lembos provides you with a MapReduce runtime and runner that allows you to write your MapReduce jobs using Node.js. Jobs run in the JVM with Hadoop driving the process, as if written in Java. Lembos provides a runner, to be ran via hadoop jar, like all other MapReduce jobs, and a runtime that provides the bridge between the Java- based Hadoop world and the JavaScript-based Node.js world. The name Lembos is a play on Trireme. (A Trireme is an ancient warship with “three banks of oars”. Since Trireme made this project possible, it seemed fitting to have a similar name. A Lembos is a lightweight warship typically used for piracy...not that I’m planning the same thing.) Project Homepage: https://github.com/apigee/lembos Introducing Lembos
  • 18. ● Trireme: https://github.com/apigee/trireme ● Lembos: https://github.com/apigee/lembos ● Anatomy of a Node.js MapReduce Job ● Lembos Architecture ● Lembos CLI Reference ● Lembos Node.js API Reference ● The Slides: http://www.slideshare.net/whitlockjc ● Contacting me: ● Twitter: @whitlockjc ● GitHub: whitlockjc Resources