Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RailsのCacheつかってますか?@表参道.rb #44
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
YABOO JAPAN
March 07, 2019
800
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RailsのCacheつかってますか?@表参道.rb #44
YABOO JAPAN
March 07, 2019
Transcript
28 slides
RailsͷCache͔ͭͬͯ·͔͢ʁ @yaboojp on දࢀಓ.rb #44 2019/3/7
Self • Name: େ༅ Ӭ / @yaboojp • Jobs: •
22Inc. Co-Founder & CTO • ex NTTdata • Location: ژ -> ౦ژ • Favorites: ΫϥϑτϏʔϧ, Իָ, όΠΫ, JALϚΠ ϧ
None
Cacheͱ͍ͬͯ৭ʑ $MJFOU /HJOY 6OJDPSO 3%#.4 )UUQ)FBEFS &YQJSFT &5BH $BDIF$POUSPM
-BTU .PEJpFEͳͲ 1BHF$BDIF 'SBHNFOU$BDIF "DUJPO$BDIF .JEEMFXBSF 7BSOJTI 4RVJEͳͲ $%/ $MPVE'MPOUͳͲ 42-$BDIF ϨϕϧΩϟογϡ %/4 -#
on Railsͳͱ͚ͩ͜
PageCacheͱ • Rails3·Ͱඪ४උ͕ͩͬͨɺࠓGem • ॳճΞΫηε࣌Ҏ֎Rubyʹࣄͤ͞ͳ͍
PageCache ࣮ݧ • ྫ͑͜ΜͳϖʔδʹΔͱͲ͏͔ʁ
PageCache ݁Ռ • ݁Ռɿ 173ms => 170ms • 1.7%ߴԽ... ͱ͍͏͔ɺ΄΅มΘΒͳ͍
• ಈతίϯςϯπ͕গͳ͍ViewͰΔҙຯ͋·Γͳ ͍ • ͨͩɺunicornͳͲͷAppαʔόͷෛՙܰݮɺো࣌ ͰฦͤΔͱ͍ͬͨϝϦοτ͋Δ
͡Ό͋ɺ ಈతίϯςϯπ͕ଟ͍ϖʔδ ͰPageCacheͬͯΈΑ͏
PageCache ҙ • Railsͷaction͕Ұ࣮ߦ͞Εͳ͍ͨΊɺ֤छ ϩδοΫͪΖΜɺೝূ͢Β͢Γൈ͚Δ Ϣʔβຖͷ ίϯςϯπΤϦΞ ͕͜͜ॳճʹΞΫηεͨ͠Ϣʔβͷใͱͯ͠Ϩϯμ Ϧϯά͞Εͨ)5.-Λৗʹฦ͢ ˞෦తʹ"KBYߋ৽͢Δઃܭ͋Γ
͍ॴ͕ͳ͔ͬͨ
PageCache ΦϚέ • ͠ΐ͏͕ͳ͍ͷͰɺ͜͏͍͏࣮ݧ • ݁Ռɿ 1100ms => 100ms ͙Β͍
PageCache ·ͱΊ • Railsʹ౸ୡ͠ͳ͍ͷڧ͍ • ίϯςϯπͷग़͚͠ͳͲʹ͑ͳ͍ͳͲ ͍ॴ͕ݶఆ͞ΕΔ • ಋೖίετΊͬͪΌ͍
ݟ!!...??
࣍ʂʂ
FragmentCacheͱ • ҰϨϯμϦϯάͨ͠ViewϑΝΠϧΛϑϥά ϝϯτͱ͍͏୯ҐͰCacheStoreʹอଘ Ωϟογϡ͍ͨ͠ ΤϦΞ 'SBHNFOU
FragmentCache ઃఆ • อଘઌࣗ༝ʹઃఆ
FragmentCache ͍ํ • key id + updated_at ͱ͔ҰҙʹͳΔΑ͏ʹ
ϩγΞϯυʔϧΩϟογϡ
FragmentCache σόοά • ։ൃڥઃఆೖΕͱ͘ͱ • ͜ΜͳΩϟογϡͷར༻ঢ়گ͕֬ೝͰ͖Δ
FragmentCache #1 • ͋Γ;Εͨใϖʔδ • 800ms -> 720ms 10%ߴԽ
FragmentCache #2 • ΊͬͪΌॏ͍ϖʔδ • 9925ms -> 805ms 1240%ߴԽ ͳΜ͔ΞϗΈ͍ͨ
ʹॏ͍ϖʔδ ʢ/ ؚΉʣ
దʹExpireͤ͞Δ keyʹҙ • id + updated_at ͱ͔͕ϕετϓϥΫςΟε • ϛεͬͨΒେࣄނʹͳΔ͜ͱ
ΩϟογϡͰૣͯ͘͠Α Ωϟογϡͳ͍ͱ͍ ͬͱΩϟογϡΛ ͍ʂʂ ੑೳ Ωϟογϡ ผͷՕॴ͕͘ͳΔͱ Ωϟογϡ
༻๏ɾ༻ྔΛकͬͯ ਖ਼͓͍͍ͩ͘͘͠͞
None
We Are Hiring
Thanks
More Decks by YABOO JAPAN
See All by YABOO JAPAN
RubyKaigiでもらった熱量がOSSに変換された話@AFTER RubyKaigi 2019
yaboojp
0
2.8k
RailsでViewModel導入に 挫折しかけてる話@表参道.rb #44
yaboojp
1
1k
サービス開発する平成の君に 昭和の僕から伝えたい7つのこと@平成.rb #2
yaboojp
0
820
夏休みの宿題 8/31にやらない話 @Otemachi.rb #14
yaboojp
0
360
ぼくが考える最強のApplicationModel @表参道.rb #43
yaboojp
0
790
大掃除 on Rails @Otemachi.rb #12
yaboojp
1
92
使わない機能の倒し方 @s-dev talks 〜サービス開発勉強会〜 大忘年LT大会
yaboojp
0
120
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
350
Navigating Team Friction
lara
192
16k
Practical Orchestrator
shlominoach
192
12k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
Building Adaptive Systems
keathley
44
3.3k
Facilitating Awesome Meetings
lara
57
7.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
3k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
480
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
What's in a price? How to price your products and services
michaelherold
247
13k