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
30万人の同時アクセスに耐えたい!新サービスの盤石なリリースを支える負荷試験 / SRE Kaigi 2026
genda
4
1.3k
ClickHouseはどのように大規模データを活用したAIエージェントを全社展開しているのか
mikimatsumoto
0
230
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.5k
15 years with Rails and DDD (AI Edition)
andrzejkrzywda
0
190
Agile Leadership Summit Keynote 2026
m_seki
1
610
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
150
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
レガシー共有バッチ基盤への挑戦 - SREドリブンなリアーキテクチャリングの取り組み
tatsukoni
0
210
Azure Durable Functions で作った NL2SQL Agent の精度向上に取り組んだ話/jat08
thara0402
0
180
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
Featured
See All Featured
The SEO identity crisis: Don't let AI make you average
varn
0
240
Navigating Weather and Climate Data
rabernat
0
100
Navigating Team Friction
lara
192
16k
Six Lessons from altMBA
skipperchong
29
4.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
Bash Introduction
62gerente
615
210k
How STYLIGHT went responsive
nonsquared
100
6k
Code Review Best Practice
trishagee
74
20k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.6k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
0
250
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