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
Froze middleware talk
Search
Atul Bhosale
July 29, 2017
Technology
49
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Froze middleware talk
I had given this talk at Deccan Ruby Conf 2017, Pune
Atul Bhosale
July 29, 2017
More Decks by Atul Bhosale
See All by Atul Bhosale
Lets enhance ActionCable
atul9
0
64
Mystery of Realtime
atul9
0
52
Other Decks in Technology
See All in Technology
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
330
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
280
Benchmarking Disaggregated Serving on vLLM + Dynamo with a Real Coding-Agent Workload
nttcom
1
190
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
230
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
170
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
4
1.1k
How to Design Configuration for Rails Applications
willnet
1
770
Local CI × GitHub Actions
gogutan
2
190
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
940
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
We Are The Robots
honzajavorek
0
400
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Automating Front-end Workflow
addyosmani
1369
210k
Balancing Empowerment & Direction
lara
6
1.3k
Un-Boring Meetings
codingconduct
0
460
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Embracing the Ebb and Flow
colly
88
5.2k
How to make the Groovebox
asonas
2
2.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Claude Code のすすめ
schroneko
67
230k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
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