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
The Cacher in the Rye
Search
Tsukasa OISHI
December 07, 2018
Programming
1
5.8k
The Cacher in the Rye
Tsukasa OISHI
December 07, 2018
Tweet
Share
More Decks by Tsukasa OISHI
See All by Tsukasa OISHI
怖くないメモリ肥大化
tsukasa_oishi
1
52
SLI/SLO をストリーム アラインドチームに導入した話
tsukasa_oishi
0
150
JITをたどるとそこはYARVの中
tsukasa_oishi
0
550
ISeqで遊ぼう
tsukasa_oishi
0
5k
Rubyを30倍速くした話
tsukasa_oishi
0
1.1k
はてブ砲をくらったときのお話
tsukasa_oishi
0
1.9k
食べログで動いている自作ライブラリのお話
tsukasa_oishi
0
290
奥さんとプログラミングを両立させる方法
tsukasa_oishi
0
50
MiyazakiResistanceを作ってみたよ
tsukasa_oishi
0
890
Other Decks in Programming
See All in Programming
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
270
Security_for_introducing_eBPF
kentatada
0
110
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
250
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
320
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
42 best practices for Symfony, a decade later
tucksaun
1
180
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
720
CSC305 Lecture 26
javiergs
PRO
0
140
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
php-conference-japan-2024
tasuku43
0
230
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
The Language of Interfaces
destraynor
154
24k
Being A Developer After 40
akosma
87
590k
Speed Design
sergeychernyshev
25
670
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Faster Mobile Websites
deanohume
305
30k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Practical Orchestrator
shlominoach
186
10k
Adopting Sorbet at Scale
ufuk
73
9.1k
Transcript
Tsukasa Oishi tsukasaoishi 5IF$BDIFSJOUIF3ZF
͓͓͍͔ͭ͠͞
None
None
None
None
GSBHNFOUDBDIF
ߋ৽සͷ͍ίϯςϯπ
-40 -20 0 20 40 4݄ 5݄ 6݄ 7݄ 8
-40 -20 0 20 40 4݄ 5݄ 6݄ 7݄ 8
Eviction
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
256B 307B
NFNDBDIFE࠶ىಈ
3BJMTσϑΥϧτͰΩϟογϡۭ͕ؒͻͱͭ
ڧ͍͕ͭಠΓΊ
CJU[FS@TUPSFHFN STU@PCKFDUT VTFS@GPPUFS TIBSFE STU@GPPUFS FYUFSOBM
CJU[FS@TUPSFHFN Rails.cache.fetch(key, sheep: :rst_footer) STU@PCKFDUT VTFS@GPPUFS EFGBVMU STU@GPPUFS FYUFSOBM
PCKFDUDBDIF
3FTUBVSBOUpOE@CZ@DBDIF JE
3BJMTDBDIFGFUDI ʜ EP 3FTUBVSBOUQSFMPBE SFTUBVSBOU@TDPSF QSFGFDUVSF DBUFHPSZ@BT
pOE JE FOE
৯ϩάͷ͋ͪΒͪ͜ΒͰ ΘΕΔΑ͏ʹͳͬͨ
Benchmark.driver do |x| x.report "AR", %|Restaurant.preload( :restaurant_score, :prefecture, :category_as ).find(1)|
x.report "cache", %|Rails.cache.read(“1")| x.report "mono", %|Restaurant.find(1)| x.compare! end
mono: 1887.1 i/s cache: 729.3 i/s - 2.59x slower AR:
57.5 i/s - 32.84x slower
3FTUBVSBOUΦϒδΣΫτ͕ཉ͍͚ͩ͠ͳΒ ;ͭ͏ʹ3FTUBVSBOUpOEͨ͠΄͏͕ ͔ͬͨʜ
Ωϟογϡʹ ίετ͕͔͔Δ
طଘͷίʔυͯ͠·ͤΜ
mono: 1887.1 i/s cache: 729.3 i/s - 2.59x slower AR:
57.5 i/s - 32.84x slower 2.59ഒ ͍! େมͩ!
NTͷͩ͠ɺͦ͜ϘτϧωοΫͰͳ͍
DBDIFDMFBS
3FTUBVSBOU DSFBUFVQEBUFEFMFUF 3FTUBVSBOU PCKFDUDBDIF 3FTUBVSBOU GSBHNFOUDBDIF
SFTUBVSBOUTςʔϒ ϧʹ ΧϥϜՃͰྫ֎ൃੜ
3FTUBVSBOU DSFBUFVQEBUFEFMFUF 3FTUBVSBOU PCKFDUDBDIF 3FTUBVSBOU GSBHNFOUDBDIF 3FTUBVSBOU BMUFSUBCMF
ϚΠΫϩαʔϏε
3FTUBVSBOU DSFBUFVQEBUFEFMFUF 3FTUBVSBOU PCKFDUDBDIF 3FTUBVSBOU GSBHNFOUDBDIF 3FTUBVSBOU BMUFSUBCMF 3FTUBVSBOU DSFBUFVQEBUFEFMFUF
3FTUBVSBOU GSBHNFOUDBDIF
Ͳ͏ӡ༻͢Δʹͯ͠ίετ૿େ͢Δ
ԯਓͷਓͨͪΛ͚ͩͤ͢͜͠ʹ͢Δ XFBSFIJSJOH
Ωϟογϡ͍ΕΕ ͪΐͬͺͰ͢Α
ӡ༻Λߟ্͑ͨͰ Λݴ͓ͬͯΔͷ͔
తͱظ͢ΔޮՌ ϨεϙϯελΠϜΛ͍ͨ͘͠ αʔόϦιʔεΛิ͍͍ͨ
ӡ༻ͱίετ ΩϟογϡσʔλͷҰੜ ͯ͢ͷΩϟογϡ͕ফ͑ͨͱ͖ ΩϟογϡΛҙ࣮ࣝͨ͠ ࢹͱอक
ϦεΫ ΩϟογϡΛΊΒΕͳ͍ దͰͳ͍Ωϟογϡ͕ΘΕͨ Ωϟογϡ͕ফ͑ͳ͍ ώοτ͗ͯ͢ίετ͚͕͔͔ͩΔ
ΩϟογϡΛ͍͍ͨͱࢥͬͨͱ͖ͷߟ͑ํ
Θͳ͍
ϨεϙϯελΠϜΛ͍ͨ͘͠ αʔόϦιʔεΛิ͍͍ͨ
ͪΌΜͱߟ͑ͯઃܭͱ࣮Λ͢Ε తΛୡͰ͖Δ
Ͱɺ ͜ΕΛΖ͏ͱͨ͠Β Ͳ͏ͬͨͬͯ Ωϟογϡൈ͖͡ΌແཧͩΖ
اըͷஈ֊Ͱʮ͜Εةͳ͘ͶʁʯΛײ͡औΔ
ຊʹΓ͍ͨ͜ͱΛཧղͯ͠ ઐՈͱͯ͠ ͖ͪΜͱͨ͠ସҊΛग़͢
Ωϟογϡʹର͢Δߟ͑ํ
ෛ࠴
ෛ࠴ѱ Ͱͳ͍
͍͟ͱ͍͏ͱ͖ ֮ޛΛͬͯ ෛ࠴Λഎෛ͏
৯ϩάͰͷΩϟογϡ ेͳϦιʔε͕͋ΔͷͰجຊతʹΩϟογϡෆཁ ಥൃతͳΞΫηε૿ʹରԠ͢ΔͨΊʹ ࣌ؒ55-ͷΞΫγϣϯΩϟογϡΛ ͍ͬͯΔ͜ͱ͋Δ աڈʹ࡞ͬͯͣͬͱӡ༻͞Ε͚͍ͭͮͯΔ มͳΩϟογϡ͕͍͔ͭ͋͘ΔͷͰ ͳ͍͖͍ͯͨ͘͠
͓͠·͍