$30 off During Our Annual Pro Sale. View Details »
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
60
The Making of a Coronavirus Dashboard
botic
0
130
Seestadt.bot @ Demo Night: Chatbots & Voice Apps
botic
0
130
Seestadt come2gether – StadtKatalog
botic
0
69
Location-aware Documents
botic
0
110
Chatbots @ HacksHackers Munich
botic
0
87
Chatbots @ Mediencamp Vienna
botic
0
170
GEN Editors Lab Munich – BotOx / Team ORF
botic
0
280
Final Master Thesis Presentation
botic
0
180
Other Decks in Programming
See All in Programming
connect-python: convenient protobuf RPC for Python
anuraaga
0
390
tparseでgo testの出力を見やすくする
utgwkk
1
190
Tinkerbellから学ぶ、Podで DHCPをリッスンする手法
tomokon
0
120
Cap'n Webについて
yusukebe
0
130
堅牢なフロントエンドテスト基盤を構築するために行った取り組み
shogo4131
8
2.3k
Why Kotlin? 電子カルテを Kotlin で開発する理由 / Why Kotlin? at Henry
agatan
2
6.9k
生成AIを利用するだけでなく、投資できる組織へ
pospome
0
250
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
2.2k
エディターってAIで操作できるんだぜ
kis9a
0
700
251126 TestState APIってなんだっけ?Step Functionsテストどう変わる?
east_takumi
0
310
AIコーディングエージェント(NotebookLM)
kondai24
0
170
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
Designing for Performance
lara
610
69k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
A Modern Web Designer's Workflow
chriscoyier
698
190k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
390
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
The Language of Interfaces
destraynor
162
25k
Designing Experiences People Love
moore
143
24k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
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