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
PHPで学ぶCacheの距離の話
Search
Ryo Tomidokoro
October 31, 2018
Programming
1
980
PHPで学ぶCacheの距離の話
Cacheの距離について
Ryo Tomidokoro
October 31, 2018
Tweet
Share
More Decks by Ryo Tomidokoro
See All by Ryo Tomidokoro
集中して作業する技術/how_to_work_deeply
hanhan1978
61
40k
PHPでデータベースを作ってみた/create-data-with-php
hanhan1978
10
9.1k
ADRを一年運用してみた/adr_after_a_year
hanhan1978
8
3.4k
B+木入門:PHPで理解する データベースインデックスの仕組み/b-plus-tree-101
hanhan1978
5
4.5k
ADRを一年運用してみた/our_story_about_adr
hanhan1978
5
1.9k
PHPで学ぶ Session の基本と応用 / web-app-session-101-2024
hanhan1978
12
5.5k
レガシー回避のPHP開発術/avoid_php_legacy
hanhan1978
16
12k
Laravel Collectionの計算量を調べてみた2023/laravel_collection_time_complexity_2023
hanhan1978
1
1.4k
PHP で学ぶ Cache の距離の話 / study_cache_with_php
hanhan1978
7
2.1k
Other Decks in Programming
See All in Programming
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
200
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
4
1.1k
Ethereum_.pdf
nekomatu
0
430
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
3
890
Amazon Qを使ってIaCを触ろう!
maruto
0
380
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
1.7k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
760
EventSourcingの理想と現実
wenas
6
2.3k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
A Tale of Four Properties
chriscoyier
156
23k
Practical Orchestrator
shlominoach
186
10k
A Philosophy of Restraint
colly
203
16k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Documentation Writing (for coders)
carmenintech
65
4.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Transcript
PHPͰֶͿCacheͷڑͷ 1)1ษڧձ
Cacheͱʁ
Oxford Dictionary ΑΓ An auxilirary memory from which high speed
retrieval is possible ߴͰσʔλऔಘ͕Ͱ͖ΔهԱஔ
WebΞϓϦͰͷར༻༻్ ߴෛՙΫΤϦͷॲཧ݁Ռ ूܭॲཧͷ݁Ռ ϧʔςΟϯά ઃఆϑΝΠϧ CDNͱ͔ϒϥβΩϟογϡɺࠓճର֎
ࠓ͢͜ͱ CacheͷޮՌΛࣄલʹѲ͢Δ͜ͱ ΑΓߴ͍ޮՌΛಘΔͨΊͷCacheͷڑͷ
ࠓ͞ͳ͍͜ͱ CacheͷϛυϧΣΞ Cacheͷӡ༻ ࢀߟ1 WebαʔϏεʹ͓͚ΔΩϟογϡઓུ https://speakerdeck.com/yusukebe/websabisuniokeru-kiyatusiyuzhan-lue ࢀߟ2 WebΞϓϦέʔγϣϯͷΩϟογϡઓུͱͦͷύλʔϯ https://speakerdeck.com/moznion/pattern-and-strategy-of-web-application-caching
CacheͷޮՌΛࣄલʹѲ͢Δ
CacheΛ͏͜ͱͰԿނ͘ͳΔͷ͔ʁ
ྫ͑͜Μͳߏ
ಉҰωοτϫʔΫͷDBͷΫΤϦ݁ՌΛCache ΫΤϦ݁ՌΛಘΔ·Ͱͷ࣌ؒ 5$1ଓ $16ԋࢉ %JTL*0 MySQL + +
5$1ଓ $16ԋࢉ %JTL*0 MySQL + + ΫΤϦ݁ՌΛಘΔ·Ͱͷ࣌ؒ - RedisʹCache 5$1ଓ
.FNPSZ*0 Redis + ಉҰωοτϫʔΫͷDBͷΫΤϦ݁ՌΛCache ΫΤϦ݁ՌΛಘΔ·Ͱͷ࣌ؒ
$16ԋࢉ %JTL*0 MySQL + .FNPSZ*0 Redis MemoryIOͷํ͕͚Εɺ্͕ݟࠐΊͦ͏
ϨΠςϯγʔ https://gist.github.com/jboner/2841832
͔͠͠ɺ͋·Γ͘ͳΒͳ͍ύλʔϯ͕͋Δ
DBͷσʔλ͕ϝϞϦʹΔ߹ ΫΤϦ݁ՌΛಘΔ·Ͱͷ࣌ؒ 5$1ଓ ΄΅.FNPSZ*0 MySQL + ΫΤϦ݁ՌΛಘΔ·Ͱͷ࣌ؒ - RedisʹCache 5$1ଓ
.FNPSZ*0 Redis +
DBͷσʔλ͕ϝϞϦʹΔ߹ ΄΅.FNPSZ*0 MySQL .FNPSZ*0 Redis Φʔμʔ͕มΘΔΑ͏ͳ্ݟࠐΊͳ͍
͜ΕҎ্ͷ্Λ͢Δʹʁʁ
WebΞϓϦ͔ΒCache·ͰͷڑΛม͑Δ 5$1ଓ .FNPSZ*0 ͬͪ͜ +
WebΞϓϦ͔ΒCache·ͰͷڑΛม͑Δ 5$1ଓ .FNPSZ*0 ͬͪ͜ + TCPଓΛΊΔ -> ϩʔΧϧCache
https://gist.github.com/jboner/2841832 ϨΠςϯγʔ
PHPͰϩʔΧϧCache ϩʔΧϧRedis, Memcached -> ਏ͍ ϑΝΠϧ -> ͍͍͚Ͳ… APCu(ϝϞϦ) ->
ྑͦ͞͏ աڈͷऔΓΈ - ແཧΓOPCache͏Cache https://speakerdeck.com/hanhan1978/cachegasu-ifalsekaque-ren-suruhua
PHPͷࣄ ϓϩηεͷಠཱੑ͕ߴ͍ ॲཧऴྃޙʹϝϞϦΫϦΞ͞ΕΔ ϓϩηεؒͰͷϝϞϦڞ༗͕ग़དྷͳ͍ɻ PHPΣϒαʔόʔͷొ͕·ΕΔ
࣮ଌͯ͠Έͨ
Trans/SecͱCacheํ๏ ํ๏ USBOTTFD ϦϞʔτ.Z42- ϦϞʔτ3FEJT ϩʔΧϧ"1$V DBσʔλ͕ϝϞϦʹ͍ͬͯΔ߹ʹ͍ͭͯݕূ
·ͱΊ Latencyͷද͓֮͑ͯ͜͏Ͷ CacheʹΑΔվળݟࠐΈࣄલʹཱͯΔ ܭࢉྔ͚ͩ͡Όͳ͘ڑߟ͑Δ ͳ͓ɺCacheӡ༻পͰ͢….
͓͠·͍