$30 off During Our Annual Pro Sale. View Details »
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
97
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
73
FutureWorkz DevOps Workshop Intro
hqc
1
63
Rack for beginners
hqc
0
73
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
Lessons from Migrating to OpenSearch: Shard Design, Log Ingestion, and UI Decisions
sansantech
PRO
1
120
AIと二人三脚で育てた、個人開発アプリグロース術
zozotech
PRO
1
710
因果AIへの招待
sshimizu2006
0
960
EM歴1年10ヶ月のぼくがぶち当たった苦悩とこれからへ向けて
maaaato
0
270
【AWS re:Invent 2025速報】AIビルダー向けアップデートをまとめて解説!
minorun365
4
510
AWS Trainium3 をちょっと身近に感じたい
bigmuramura
1
140
モダンデータスタック (MDS) の話とデータ分析が起こすビジネス変革
sutotakeshi
0
470
Debugging Edge AI on Zephyr and Lessons Learned
iotengineer22
0
170
re:Inventで気になったサービスを10分でいけるところまでお話しします
yama3133
1
120
コンテキスト情報を活用し個社最適化されたAI Agentを実現する4つのポイント
kworkdev
PRO
0
150
打 造 A I 驅 動 的 G i t H u b ⾃ 動 化 ⼯ 作 流 程
appleboy
0
280
意外とあった SQL Server 関連アップデート + Database Savings Plans
stknohg
PRO
0
310
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
KATA
mclloyd
PRO
32
15k
Docker and Python
trallard
47
3.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
How GitHub (no longer) Works
holman
316
140k
The World Runs on Bad Software
bkeepers
PRO
72
12k
4 Signs Your Business is Dying
shpigford
186
22k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
We Have a Design System, Now What?
morganepeng
54
7.9k
How to Ace a Technical Interview
jacobian
280
24k
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!