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
Cam Huynh
October 11, 2015
Technology
0
73
Optimize Rails Asset Pipeline Deployment
Cam Huynh
October 11, 2015
Tweet
Share
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
52
FutureWorkz DevOps Workshop Day III - Gitlab Runner for CD
hqc
0
98
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
74
FutureWorkz DevOps Workshop Intro
hqc
1
63
Rack for beginners
hqc
0
74
Chat Implementation with RESTful (Ruby) and Web Socket
hqc
0
63
Monkey patching in Ruby
hqc
0
300
Other Decks in Technology
See All in Technology
Master Dataグループ紹介資料
sansan33
PRO
1
4.2k
AWS re:Invent 2025 を振り返る
kazzpapa3
2
100
202512_AIoT.pdf
iotcomjpadmin
0
180
AI時代のアジャイルチームを目指して ー スクラムというコンフォートゾーンからの脱却 ー / Toward Agile Teams in the Age of AI
takaking22
3
1k
[2025-12-12]あの日僕が見た胡蝶の夢 〜人の夢は終わらねェ AIによるパフォーマンスチューニングのすゝめ〜
tosite
0
240
BidiAgent と Nova 2 Sonic から考える音声 AI について
yama3133
2
140
Data Hubグループ 紹介資料
sansan33
PRO
0
2.5k
テストセンター受験、オンライン受験、どっちなんだい?
yama3133
0
200
善意の活動は、なぜ続かなくなるのか ーふりかえりが"構造を変える判断"になった半年間ー
matsukurou
0
130
研究開発部メンバーの働き⽅ / Sansan R&D Profile
sansan33
PRO
4
21k
2025年 山梨の技術コミュニティを振り返る
yuukis
0
140
アラフォーおじさん、はじめてre:Inventに行く / A 40-Something Guy’s First re:Invent Adventure
kaminashi
0
210
Featured
See All Featured
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
360
Game over? The fight for quality and originality in the time of robots
wayneb77
1
73
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
39
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
Un-Boring Meetings
codingconduct
0
170
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
54
Making Projects Easy
brettharned
120
6.5k
Faster Mobile Websites
deanohume
310
31k
Writing Fast Ruby
sferik
630
62k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
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!