Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RingoJS - An Introduction

RingoJS - An Introduction

This presentation gives a short overview over RingoJS and how it does multi-threaded JavaScript on the JVM.

Philipp Naderer

February 05, 2015
Tweet

More Decks by Philipp Naderer

Other Decks in Technology

Transcript

  1. History 1998 Helma 2008 HelmaNG 2010 RingoJS - monolithic -

    HopObject as root prototype - objects are mapped to db tables - advanced code repository loaders - modular approach - CommonJS modules - core modules provided - CommonJS modules - Ringo-specific modules - packages (reusable modules) - hot code reloading
  2. What is RingoJS? “Ringo is a JavaScript platform built on

    the JVM and optimized for server-side applications. It takes a non- dogmatic stance on things like I/O paradigms.”
  3. What is RingoJS? • multi-threaded JavaScript • CommonJS compatible •

    ES5 + some ES6 • code repository manager • optimized to run scalable web application
  4. What Ringo is not … • copying node / io.js

    • compatible with npm • the fastest async io framework • used by thousands of devs • JEE or similar enterprise stuff • single-threaded
  5. What we know so far … • Ringo has a

    history back to 1998 • its running on the JVM • uses multiple threads in parallel • supports blocking and non-blocking I/O • is not enterprise JavaScript
  6. So it’s time to get started! • Install OpenJDK or

    Oracle’s JRE • Download Ringo ◦ ZIP / tarball: download and extract, add /bin to PATH ◦ Homebrew: brew install ringojs • Run ringo
  7. JVM JRE Rhino JavaScript Engine RhinoEngine Class Module Loaders Workers

    Code Repositories Java parts of Ringo Ringo JsgiServlet
  8. JavaScript parts • CommonJS modules ◦ io, fs, binary, assert,

    gobals, system, net, … • Ringo modules ◦ daemon, engine, logging, promise, term, worker, httpserver, httpclient, … • Ringo utility modules ◦ strings, dates, objects, numbers, files, …
  9. Avoid concurrency at all … One single worker, but powerful

    and the worker never has to wait for resources. This is node & io.js
  10. … or assign every worker a special task Multiple workers,

    but no shared resources. This is Ringo’s approach!
  11. Create a simple web application ringo-admin create -h Creates a

    Ringo application or package. Usage: ringo-admin create [options] [path] Options: -a --app-source [DIR] Copy application from [DIR] instead of skeleton -g --google-appengine Create a new Google App Engine application -p --ringo-package Create a new Ringo package -s --symlink Create symbolic links for jar and module files -w --java-webapp Create a new Java Web application (WAR)
  12. rp package manager • ringo-admin install grob/rp • find &

    publish packages at packages.ringojs.org • rp is the command line tool ◦ download, install & publish packages ◦ packages are downloaded into a packages directory ◦ to get help: rp help [install | publish | ...]
  13. rp package manager • rp install • rp install -g

    ringo-sqlstore • rp install ringo-sqlstore // loads the installed package var sqlst = require("ringo-sqlstore");
  14. Popular packages • stick – web application framework • reinhardt

    – Django-like templating • ringo-sqlstore – JavaScript-based ORM • gestalt – easy configuration management
  15. “ringojs created because the java guys believe java and want

    to integrate javascript with java on the server side.” True! We want to use the power of the JVM to run JavaScript on the server.
  16. Why JavaScript on the JVM? • Interpreted language → hot

    code reloading! • JVM is a very stable and fast technology • A huge ecosystem exists (Java & JavaScript) • Web developers know JavaScript • Server admins know the JVM
  17. “Java guys believe in Java …” • Enterprise-proven money representation?

    ◦ Joda-Money instead of 0.1 + 0.2 = 0.30000000000000004 • Timezones? Timezone updates? ◦ Joda-Time or java.time (Java SE 8) • An alternative if your company is JEE hell? ◦ Ringo runs seamless in servlet containers
  18. “nodejs created because Ryan want a effective way to create

    net app no I/O blocking. He choose javascript because js has no old/outdated libs, which usually are the main problem of your I/O blocking.”
  19. And till the end, we've found js is so beautiful

    and java IS SO UGLY. If you look at Ringo’s Java core, you find a lot of beautiful and amazing Java code. Hannes, the creator of Ringo, worked on it for years.
  20. Only stupid guy want to use java to rebuild js.

    JavaScript → language, JVM → abstract machine There are a lot of JVM-languages available: Java, Scala, JavaScript, Clojure, Groovy, …