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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Phase05_ClaudeCode入門
overflowinc
0
580
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
130
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
1
730
Agent Skill 是什麼?對軟體產業帶來的變化
appleboy
0
160
エンジニアリングマネージャーの仕事
yuheinakasaka
0
120
中央集権型を脱却した話 分散型をやめて、連邦型にたどり着くまで
sansantech
PRO
1
170
VLAモデル構築のための AIロボット向け模倣学習キット
kmatsuiugo
0
310
ソフトバンク流!プラットフォームエンジニアリング実現へのアプローチ
sbtechnight
1
230
Laravelで学ぶOAuthとOpenID Connectの基礎と実装
kyoshidaxx
4
1.5k
Everything Claude Code を眺める
oikon48
13
8.9k
Copilot 宇宙へ 〜生成AIで「専門データの壁」を壊す方法〜
nakasho
0
130
プラットフォームエンジニアリングはAI時代の開発者をどう救うのか
jacopen
8
4.1k
Featured
See All Featured
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
Designing Experiences People Love
moore
143
24k
Technical Leadership for Architectural Decision Making
baasie
3
300
The Limits of Empathy - UXLibs8
cassininazir
1
270
Abbi's Birthday
coloredviolet
2
5.5k
Faster Mobile Websites
deanohume
310
31k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
490
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Side Projects
sachag
455
43k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
380
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