Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Concurrent SSJS on the JVM
Search
Philipp Naderer
February 19, 2014
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Concurrent SSJS on the JVM
Presentation from the Fronteers Jam Session 2012 in Amsterdam.
Philipp Naderer
February 19, 2014
More Decks by Philipp Naderer
See All by Philipp Naderer
Im Maschinenraum der Corona-Dashboards
botic
0
80
The Making of a Coronavirus Dashboard
botic
0
150
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
140
Seestadt come2gether – StadtKatalog
botic
0
76
Location-aware Documents
botic
0
120
Chatbots @ HacksHackers Munich
botic
0
100
Chatbots @ Mediencamp Vienna
botic
0
180
GEN Editors Lab Munich – BotOx / Team ORF
botic
0
310
Final Master Thesis Presentation
botic
0
200
Other Decks in Programming
See All in Programming
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
190
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
610
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
390
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
130
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
210
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
310
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
590
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
370
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
140
夏だ!祭りだ!祭りとはドメインモデリングでは?
ryugen04
0
190
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
160
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
220
Featured
See All Featured
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
420
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
270
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
240
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
400
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
660
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
410
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
A designer walks into a library…
pauljervisheath
211
24k
WCS-LA-2024
lcolladotor
0
790
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Transcript
Concurrent SSJS on the JVM Philipp Naderer / @botic
None
None
RingoJS • JavaScript on the JVM • Based on Mozilla
Rhino • Part of Java SE 6 and Java SE 7 • Successor / Rewrite of Helma • 14 years of SSJS experience!
Features • CommonJS modules & packages • Full access to
Java libraries • ECMAScript 5 and JS 1.8 support • Lots of „ringo/“ modules • dates, http, concurrency, logging, subprocesses, jsgi, command line, ...
Debugger
Threads and SSJS? • Ringo‘s concept: Workers • Implicit multithreaded
code • You can use an EventLoop • No shared global object* • Singletons instead of shared data
myWebApp Module myWebApp Module blocking running running Event Loop
webserver.js var response = require("ringo/jsgi/response"); var {Application} = require("stick"); !
var app = exports.app = new Application(); ! // Configure stick middlewares app.configure("notfound", "route"); ! app.get("/", function(request) { return response.html("<h1>Servas Amsterdam!</h1>"); }); ! if (require.main == module) { require("ringo/httpserver").main(module.id); }
webserver.js serving 10.000 HTTP requests
„Ringo Workers“ • Look like Web Workers in Browsers •
No JSON serialization needed = faster! • Send a message with postMessage(e) • React on message with onMessage(e) • Return the result to the caller with postMessage(e)
fibobuster.js 1. var {Worker} = require("ringo/worker"); 2. 3. // Create
50 Workers = 50 Threads 4. for (var i = 50; i < 100; i++) { 5. var w = new Worker(module.resolve("./fibonacci")); 6. 7. // Callback for the output 8. w.onmessage = function(returnObj) { 9. console.log("Result: " + returnObj.data.result); 10. } 11. 12. // Start with the calculation 13. w.postMessage(i); 14. }
fibonacci.js function onmessage(message) { var limit = message.data; ! console.log("Fibonacci
#" + limit); ! /* Calculate the fibonacci number */ var a = ..., b = ..., c = ...; for (...) { ... } ! message.source.postMessage({ result: c }); }
RingoJS infos • ringojs.org – basic information • github.com/ringojs –
source + examples • @ringojs – official account • @hannesw – Hannes‘ account • IRC: irc.freenode.net #ringojs
None