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
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
累計5000万DLサービスの裏側 – LINEマンガのKotlinで挑む大規模 Server-side ETLの最適化
ldf_tech
0
190
設計は最強のプロンプト - AI時代に武器にすべきスキルとは?-
kenichirokimura
1
160
サブドメインテイクオーバー事例紹介と対策について
mikit
16
7.5k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
0
440
AIがコードを書いてくれるなら、新米エンジニアは何をする? / komekaigi2025
nkzn
25
17k
龍昌餃子で理解するWebサーバーの並行処理モデル - 東葛.dev #9
kozy4324
1
120
仕様駆動開発を実現する上流工程におけるAIエージェント活用
sergicalsix
12
5.9k
AIの個性を理解し、指揮する
shoota
3
640
今から間に合う re:Invent 準備グッズと現地の地図、その他ラスベガスを周る際の Tips/reinvent-preparation-guide
emiki
1
290
Design and implementation of "Markdown to Google Slides" / phpconfuk 2025
k1low
1
200
Digitization部 紹介資料
sansan33
PRO
1
5.8k
Snowflakeとdbtで加速する 「TVCMデータで価値を生む組織」への進化論 / Evolving TVCM Data Value in TELECY with Snowflake and dbt
carta_engineering
0
160
Featured
See All Featured
Thoughts on Productivity
jonyablonski
72
4.9k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
2
270
Measuring & Analyzing Core Web Vitals
bluesmoon
9
660
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Designing for Performance
lara
610
69k
Bash Introduction
62gerente
615
210k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
950
Six Lessons from altMBA
skipperchong
29
4k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
How to Think Like a Performance Engineer
csswizardry
27
2.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!