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
Optimize Rails Asset Pipeline Deployment
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Cam Huynh
October 11, 2015
Technology
74
0
Share
Optimize Rails Asset Pipeline Deployment
Cam Huynh
October 11, 2015
More Decks by Cam Huynh
See All by Cam Huynh
Reddit Ruby Conf 2016 Recap
hqc
0
120
FutureWorkz DevOps Workshop Day II - Deploying Rails
hqc
0
53
FutureWorkz DevOps Workshop Day III - Gitlab Runner for CD
hqc
0
100
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
75
FutureWorkz DevOps Workshop Intro
hqc
1
64
Rack for beginners
hqc
0
75
Chat Implementation with RESTful (Ruby) and Web Socket
hqc
0
64
Monkey patching in Ruby
hqc
0
300
Other Decks in Technology
See All in Technology
Cursor Subagentsはいいぞ
yug1224
2
130
Cortex Code君、今日から内製化支援担当ね。
coco_se
0
190
GitHub Advanced Security × Defender for Cloudで開発とSecOpsのサイロを超える: コードとクラウドをつなぐ、開発プラットフォームのセキュリティ
yuriemori
1
120
BFCacheを活用して無限スクロールのUX を改善した話
apple_yagi
0
140
MCPで決済に楽にする
mu7889yoon
0
170
最大のアウトプット術は問題を作ること
ryoaccount
0
270
Sansanの認証基盤を支えるアーキテクチャとその振り返り
sansantech
PRO
1
150
The essence of decision-making lies in primary data
kaminashi
0
230
Zephyr(RTOS)でARMとRISC-Vのコア間通信をしてみた
iotengineer22
0
120
AIエージェント勉強会第3回 エージェンティックAIの時代がやってきた
ymiya55
0
230
【Oracle Cloud ウェビナー】データ主権はクラウドで守れるのか?NTTデータ様のOracle Alloyで実現するソブリン対応クラウドの最適解
oracle4engineer
PRO
3
130
Network Firewall Proxyで 自前プロキシを消し去ることができるのか
gusandayo
0
170
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
950
Done Done
chrislema
186
16k
Code Reviewing Like a Champion
maltzj
528
40k
The Invisible Side of Design
smashingmag
302
51k
RailsConf 2023
tenderlove
30
1.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Embracing the Ebb and Flow
colly
88
5k
Navigating Weather and Climate Data
rabernat
0
160
A designer walks into a library…
pauljervisheath
211
24k
BBQ
matthewcrist
89
10k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Transcript
ASSET PIPELINE OPTIMIZATION by @huynhquancam
WHAT SHOULD YOU KNOW ABOUT THIS GUY? My name is
Huynh Quan Cam. Responsible for the development and engineering of Dadadee.
WHAT’S THE TALK ABOUT? Rails Assets pipeline. Deploy assets pipeline
on multiple servers. How to optimize the deployment?
ASSETS PIPELINE concatenate and minify or compress JavaScript and CSS
assets. support pre-processors such as CoffeeScript, Sass and ERB. based on Sprockets.
USING ASSET PIPELINE
– The Rails core team. “TIPS OF THE DAY” You
can get rid of sprockets by executing this command at the start. rails new my-awesome-app-without-sprockets --skip-sprockets
SITUATION we are deploying an Rails app to four servers:
2 web, 1 database and 1 worker. db and worker servers need static assets to work. zero-down time deployment and rollback required.
CAPISTRANO-RAILS capistrano-rails is a set of Capistrano tasks to automate
Rails deployment. migrations. assets pre-compilation.
ORCHESTRATION SCRIPT
WHAT’S WRONG WITH THIS APPROACH? waste of time. waste of
computing resources. waste of storage resources, especially when you’re using CDNs like CloudFront.
Can we only pre-compile once?
ASSET FINGERPRINTS generated based on file content. optimize client-side caching.
better cache invalidation.
ASSET FINGERPRINT application.css application-908e25f4bf641868d8683022a5b62f54.css application.css application-723d1be6cc741a3aabb1cec24276d681.css
ASSET MANIFEST a manifest-<md5-hash>.json cache every fingerprint of your Rails
static assets. accelerate Rails helper call.
ASSET MANIFEST
NOTES fingerprints only change if file contents change. fingerprints don’t
change across servers. all fingerprint requests are handled by manifest file.
Pre-compile once and sync the manifest file to others.
IMPLEMENTATION
IMPLEMENTATION
QUESTIONS?
THANK YOU!