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
orange — Client side concurrency made simple
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Florian Plank
October 17, 2013
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
orange — Client side concurrency made simple
Florian Plank
October 17, 2013
More Decks by Florian Plank
See All by Florian Plank
Ready, set, immersion!
polarblau
0
220
Prototyping all the things
polarblau
2
200
CoffeeScript vs. ECMAScript 6
polarblau
5
3.7k
Design for a complex Reality — Siili Breakfast Edition
polarblau
0
180
Enabling Design for a Complex Reality
polarblau
2
160
A primer on Content Security Policy
polarblau
1
480
Rails and the future of the open web
polarblau
3
150
Brief Ruby/Ruby on Rails intro
polarblau
3
210
Ruby Idioms
polarblau
3
620
Other Decks in Programming
See All in Programming
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.8k
Hello, Hiroshima Geospatial Data! — Exploring DoboX with Python
ra0kley
0
150
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.3k
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
490
VibeCodingからAgenticWorkflowへ
starfish719
0
1k
ソフトウェアエンジニアにとっての生成AI - 特性を知って使い倒す / generative ai for software enginner
kishida
7
2.3k
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
48
31k
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.4k
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1.6k
Press start. Python's next generation.
willingc
PRO
3
290
My Marp Sample
sinoue0108
0
140
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
174
15k
Design in an AI World
tapps
1
290
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
370
Building AI with AI
inesmontani
PRO
1
1.2k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
230
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Navigating Weather and Climate Data
rabernat
0
500
WCS-LA-2024
lcolladotor
0
820
Bash Introduction
62gerente
615
220k
Code Reviewing Like a Champion
maltzj
528
40k
Become a Pro
speakerdeck
PRO
31
6.2k
Transcript
orange — Client side concurrency made simple
rubysauna.org
heartrate.js
None
None
None
None
Concurrency
A B C
A B C
A B C
Concurrency is hard
A B C
Concurrency
Barber z z
Barber Customer z z Sleeping?
Barber Customer
Barber Customer Working?
Barber Customer
Barber
Barber Customer
Barber
Barber Customer ?
Barber Customer Crap.
Barber
Barber Customer
Barber z z Crap.
Concurrency in the browser
JavaScript and the golden thread
None
None
None
foo() 10ms 20ms 30ms 40ms click handled click fired setInterval
(10ms)
None
Synchronous —vs— Asynchronous
WebWorkers
JavaScript Thread Worker
Worker JavaScript Thread
Worker Worker JavaScript Thread
Dedicated, Shared & Inline Workers
None
orange
The queue
Define a worker
# workers/sum.coffee importScripts 'orange/worker.js' perform (data)-> data.numbers.reduce (a, b)-> a
+ b
# workers/sum.coffee importScripts 'orange/worker.js' perform (data)-> data.numbers.reduce (a, b)-> a
+ b
Create a new job
job = new Orange.Job('sum', numbers: [1..100])
job = new Orange.Job('sum', numbers: [1..100]) job.on 'success', (response) ->
console.log('Sum', response) job.perform()
Events
job.on 'success', (response)-> job.on 'complete', -> job.on 'error', (error)-> job.on
'failure', (error)->
Logging
# workers/sum.coffee importScripts 'orange/worker.js' perform (data)-> log 'The background worker
Gotham deserves ...' data.numbers.reduce (a, b) ->a + b
Batches
batch = new Orange.Batch
batch = new Orange.Batch job = new Orange.Job('sum', [1..100]) batch.push
job batch.perform()
batch = new Orange.Batch [job1, job2, job3]
batch.on 'complete', (jobs) -> batch.on 'job:success', (job) -> batch.on 'job:complete',
(job)-> batch.on 'job:error', (job) -> batch.on 'job:failure', (job) ->
job.getResponse() job.getLastError()
Configuration
Orange.Config.set maxWorkerPoolSize: 4 maxRetries : 3 workersPath : '/lib/workers/'
Retry mechanism and exponential back–off
Error handling
job.on 'error', (error)-> throw error BatchStateTransitionError JobStateTransitionError ResponderNotFoundError …
None
Roadmap >0.2.0
Customized Worker Shim Test coverage Data serialization Benchmarking
Forward arbitrary method calls to worker? Custom events? Instrumentation? Inline
Workers? Helper modules?
Kiitos!
@polarblau