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
0
110
Concurrent SSJS on the JVM
Presentation from the Fronteers Jam Session 2012 in Amsterdam.
Philipp Naderer
February 19, 2014
Tweet
Share
More Decks by Philipp Naderer
See All by Philipp Naderer
Im Maschinenraum der Corona-Dashboards
botic
0
54
The Making of a Coronavirus Dashboard
botic
0
130
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
120
Seestadt come2gether – StadtKatalog
botic
0
68
Location-aware Documents
botic
0
100
Chatbots @ HacksHackers Munich
botic
0
85
Chatbots @ Mediencamp Vienna
botic
0
170
GEN Editors Lab Munich – BotOx / Team ORF
botic
0
270
Final Master Thesis Presentation
botic
0
170
Other Decks in Programming
See All in Programming
Swift Concurrency - 状態監視の罠
objectiveaudio
2
510
Web フロントエンドエンジニアに開かれる AI Agent プロダクト開発 - Vercel AI SDK を観察して AI Agent と仲良くなろう! #FEC余熱NIGHT
izumin5210
3
510
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
530
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
620
Conquering Massive Traffic Spikes in Ruby Applications with Pitchfork
riseshia
0
160
非同期jobをtransaction内で 呼ぶなよ!絶対に呼ぶなよ!
alstrocrack
0
710
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.3k
止められない医療アプリ、そっと Swift 6 へ
medley
1
160
Cloudflare AgentsとAI SDKでAIエージェントを作ってみた
briete
0
140
Flutterで分数(Fraction)を表示する方法
koukimiura
0
130
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
250
大規模アプリのDIフレームワーク刷新戦略 ~過去最大規模の並行開発を止めずにアプリ全体に導入するまで~
mot_techtalk
1
430
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
339
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
GitHub's CSS Performance
jonrohan
1032
470k
KATA
mclloyd
32
15k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
30
2.7k
Building an army of robots
kneath
306
46k
It's Worth the Effort
3n
187
28k
Writing Fast Ruby
sferik
629
62k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
54
3k
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