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
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
380
LLMに渡さなかった仕事
nanaism
0
620
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
170
株式会社シーエーシー エンジニア向け会社紹介資料
cac
0
57k
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
25
16k
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
170
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
新機種発売前に見直そう!端末移行で再ログインが要るアプリ・要らないアプリは何が違うのか 〜シームレスに再開できる設計と実装〜
zozotech
PRO
0
210
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
160
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
230
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
2
1.4k
Reactの設計論
uhyo
24
14k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
540
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Paper Plane (Part 1)
katiecoart
PRO
2
11k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
510
Being A Developer After 40
akosma
91
590k
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