Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
orange — Client side concurrency made simple
Search
Florian Plank
October 17, 2013
Programming
170
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
230
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
170
A primer on Content Security Policy
polarblau
1
490
Rails and the future of the open web
polarblau
3
160
Brief Ruby/Ruby on Rails intro
polarblau
3
220
Ruby Idioms
polarblau
3
630
Other Decks in Programming
See All in Programming
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
170
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
160
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
0
120
setup-vp GitLab対応の裏側
naokihaba
0
120
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2.7k
スマート反転とウェブアクセシビリティ
camiha
0
210
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
410
iOSDC2026登壇資料.pdf
riofujimon
0
180
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
110
WebMCP Challenge に星空観察アプリで参加した話
okajun35
0
190
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
900
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
160
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
Documentation Writing (for coders)
carmenintech
77
5.5k
Tell your own story through comics
letsgokoyo
1
1.1k
Color Theory Basics | Prateek | Gurzu
gurzu
1
470
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
560
GraphQLとの向き合い方2022年版
quramy
50
15k
Designing Experiences People Love
moore
143
24k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Deep Space Network (abreviated)
tonyrice
0
320
How to make the Groovebox
asonas
2
2.4k
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