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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Florian Plank
October 17, 2013
Programming
0
150
orange — Client side concurrency made simple
Florian Plank
October 17, 2013
Tweet
Share
More Decks by Florian Plank
See All by Florian Plank
Ready, set, immersion!
polarblau
0
190
Prototyping all the things
polarblau
2
180
CoffeeScript vs. ECMAScript 6
polarblau
5
3.6k
Design for a complex Reality — Siili Breakfast Edition
polarblau
0
160
Enabling Design for a Complex Reality
polarblau
2
140
A primer on Content Security Policy
polarblau
1
440
Rails and the future of the open web
polarblau
3
130
Brief Ruby/Ruby on Rails intro
polarblau
3
200
Ruby Idioms
polarblau
3
600
Other Decks in Programming
See All in Programming
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.8k
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
510
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
290
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
220
Architectural Extensions
denyspoltorak
0
270
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
150
CSC307 Lecture 08
javiergs
PRO
0
660
AIエージェントの設計で注意するべきポイント6選
har1101
7
3.4k
CSC307 Lecture 07
javiergs
PRO
0
550
AtCoder Conference 2025
shindannin
0
1k
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
970
Featured
See All Featured
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
sira's awesome portfolio website redesign presentation
elsirapls
0
140
Mobile First: as difficult as doing things right
swwweet
225
10k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
63
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
Believing is Seeing
oripsolob
1
50
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Art, The Web, and Tiny UX
lynnandtonic
304
21k
A Tale of Four Properties
chriscoyier
162
24k
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