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
81
The Making of a Coronavirus Dashboard
botic
0
150
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
140
Seestadt come2gether – StadtKatalog
botic
0
77
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
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
新卒PdEのリアル
ryu1013
1
340
自分的「カンファレンスの楽しみ方」
syumai
0
190
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
260
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
260
{ Android | Kotlin } Gradle Plugin in 2026
ryunen344
1
280
PyO3 で既存 Python 評価器を Rust core 化する ー wasm-bindgen でブラウザにも配るための設計
kdash
1
360
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
110
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
300
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
230
リアルな遅延を測る仕様
kota_yata
1
140
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
0
400
Featured
See All Featured
Design in an AI World
tapps
1
300
Git: the NoSQL Database
bkeepers
PRO
432
67k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
520
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
The Spectacular Lies of Maps
axbom
PRO
1
970
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
710
Ethics towards AI in product and experience design
skipperchong
2
360
GitHub's CSS Performance
jonrohan
1033
470k
How to Ace a Technical Interview
jacobian
281
24k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
690
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