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
Froze middleware talk
Search
Atul Bhosale
July 29, 2017
Technology
0
43
Froze middleware talk
I had given this talk at Deccan Ruby Conf 2017, Pune
Atul Bhosale
July 29, 2017
Tweet
Share
More Decks by Atul Bhosale
See All by Atul Bhosale
Lets enhance ActionCable
atul9
0
57
Mystery of Realtime
atul9
0
45
Other Decks in Technology
See All in Technology
エンタメとAIのための3Dパラレルワールド構築(GPU UNITE 2025 特別講演)
pfn
PRO
0
620
WEBサービスを成り立たせるAWSサービス
takano0131
1
200
それでも私が品質保証プロセスを作り続ける理由 #テストラジオ / Why I still continue to create QA process
pineapplecandy
0
150
AI時代、“平均値”ではいられない
uhyo
6
1.6k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
43k
データ戦略部門 紹介資料
sansan33
PRO
1
3.8k
Zephyr(RTOS)にEdge AIを組み込んでみた話
iotengineer22
1
250
「魔法少女まどか☆マギカ Magia Exedra」の多様なバトルの開発を柔軟かつ効率的に実現するためのPure C#とUnityの分離について
gree_tech
PRO
0
230
Wasmの気になる最新情報
askua
0
180
Databricks AI/BI Genie の「値ディクショナリー」をAmazonの奥地(S3)まで見に行く
kameitomohiro
1
370
Claude Code Subagents 再入門 ~cc-sddの実装で学んだこと~
gotalab555
10
17k
物体検出モデルでシイタケの収穫時期を自動判定してみた。 #devio2025
lamaglama39
0
260
Featured
See All Featured
Thoughts on Productivity
jonyablonski
70
4.9k
We Have a Design System, Now What?
morganepeng
53
7.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Practical Orchestrator
shlominoach
190
11k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Being A Developer After 40
akosma
91
590k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
How GitHub (no longer) Works
holman
315
140k
Rails Girls Zürich Keynote
gr2m
95
14k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Transcript
ATUL BHOSALE CODEMANCERS @atul1b
None
Rack middleware
None
1 5 4 3 2 Web Requests
None
None
WHY?
# Non Thread safe code class Counter def initialize @counter
= 0 end def call(_env) counter = @counter sleep 1 counter += 1 @counter = counter [200, { 'Content-Type' => 'text/html' }, ["#{@counter}"]] end end
WHAT? • Don’t mutate state • Freeze middleware instances •
Use data-structures from concurrent-ruby
None
# Thread safe code class Counter def initialize @atomic =
Concurrent::AtomicReference.new(0) end def call(_env) @atomic.update { |v| v + 1 } [200, { 'Content-Type' => 'text/html' }, ["{@atomic}"]] end end
None
None
None
use (Class.new do def call(env) @a = 1 if env['PATH_INFO']
== '/a' @app.call(env) end freeze_app end)
There is no way to unfreeze a frozen object
Thank you
None