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
70
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
50
FutureWorkz DevOps Workshop Day III - Gitlab Runner for CD
hqc
0
95
Futureworkz DevOps Workshop Day 1 - DevOps ToolChain
hqc
0
69
FutureWorkz DevOps Workshop Intro
hqc
1
60
Rack for beginners
hqc
0
70
Chat Implementation with RESTful (Ruby) and Web Socket
hqc
0
60
Monkey patching in Ruby
hqc
0
300
Other Decks in Technology
See All in Technology
Tech-Verse 2025 Keynote
lycorptech_jp
PRO
0
890
PHPでWebブラウザのレンダリングエンジンを実装する
dip_tech
PRO
0
210
低レイヤを知りたいPHPerのためのCコンパイラ作成入門 完全版 / Building a C Compiler for PHPers Who Want to Dive into Low-Level Programming - Expanded
tomzoh
4
3.3k
第9回情シス転職ミートアップ_テックタッチ株式会社
forester3003
0
260
A2Aのクライアントを自作する
rynsuke
1
220
AIエージェント最前線! Amazon Bedrock、Amazon Q、そしてMCPを使いこなそう
minorun365
PRO
15
5.4k
CursorによるPMO業務の代替 / Automating PMO Tasks with Cursor
motoyoshi_kakaku
1
450
mrubyと micro-ROSが繋ぐロボットの世界
kishima
2
360
GitHub Copilot の概要
tomokusaba
1
140
ドメイン特化なCLIPモデルとデータセットの紹介
tattaka
1
200
KubeCon + CloudNativeCon Japan 2025 Recap
ren510dev
1
180
250627 関西Ruby会議08 前夜祭 RejectKaigi「DJ on Ruby Ver.0.1」
msykd
PRO
2
340
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
800
Building Applications with DynamoDB
mza
95
6.5k
How to train your dragon (web standard)
notwaldorf
94
6.1k
Side Projects
sachag
455
42k
Build The Right Thing And Hit Your Dates
maggiecrowley
36
2.8k
RailsConf 2023
tenderlove
30
1.1k
Git: the NoSQL Database
bkeepers
PRO
430
65k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Bash Introduction
62gerente
614
210k
Raft: Consensus for Rubyists
vanstee
140
7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
930
Statistics for Hackers
jakevdp
799
220k
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!