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
79
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
66
FutureWorkz DevOps Workshop Day III - Gitlab Runner for CD
hqc
0
100
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
78
FutureWorkz DevOps Workshop Intro
hqc
1
66
Rack for beginners
hqc
0
77
Chat Implementation with RESTful (Ruby) and Web Socket
hqc
0
68
Monkey patching in Ruby
hqc
0
310
Other Decks in Technology
See All in Technology
【CEDEC2026】コードレビュー支援ツール開発から学ぶ:LLMを用いた業務システムの実践的な運用設計と誤出力対策
cygames
PRO
0
820
サイバー捜査員研修(前半)
nomizone
1
2k
ガバメント AI 源内を地方自治体は活用できるのか可能性と課題、期待について
takeda_h
2
420
QAエンジニア起点で進める、SmartHRにおける信頼性向上について
kaomi_wombat
1
140
生成 AI の基礎 〜 サンプル実装で学ぶ基本原理
enakai00
7
4.4k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
4
24k
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.9k
Reference-Free Image Quality Assessment for Virtual Try-On via Human Feedback
zozotech
PRO
0
170
Apache Icebergインフラストラクチャ:ストレージ・カタログ・エンジンの選択肢とClouderaプラットフォームでの実装
tsugiyama
0
110
社内の7割が使うデータ基盤を、 データチーム2人で回すためにやったこと
koh_yoshi
4
1.4k
え?フロントエンドエンジニアの ワイがインフラも!?
puku0x
1
630
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.4k
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
540
Between Models and Reality
mayunak
4
390
Balancing Empowerment & Direction
lara
6
1.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Side Projects
sachag
455
43k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
エンジニアに許された特別な時間の終わり
watany
108
250k
The Invisible Side of Design
smashingmag
301
52k
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!