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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ryo Tomidokoro
October 31, 2018
Programming
1.1k
1
Share
PHPで学ぶCacheの距離の話
Cacheの距離について
Ryo Tomidokoro
October 31, 2018
More Decks by Ryo Tomidokoro
See All by Ryo Tomidokoro
あるアーキテクチャ決定と その結果/architecture-decision-and-its-result
hanhan1978
2
550
開発者が知っておきたい複雑さの正体/where-the-complexity-comes-from
hanhan1978
8
3.5k
Spec Driven Development入門/spec_driven_development_for_learners
hanhan1978
2
1.8k
フロントエンドがTypeScriptなら、バックエンドはPHPでもいいじゃない/php-is-not-bad
hanhan1978
8
14k
どうすると生き残れないのか/how-not-to-survive
hanhan1978
17
15k
100分で本番デプロイ!Laravelで作るWebアプリケーション作成/100min_web_app_cicd
hanhan1978
1
260
PHPerのための計算量入門/Complexity101 for PHPer
hanhan1978
8
3.6k
集中して作業する技術/how_to_work_deeply
hanhan1978
65
56k
PHPでデータベースを作ってみた/create-data-with-php
hanhan1978
11
11k
Other Decks in Programming
See All in Programming
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
2
1.4k
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
PDI: Como Alavancar Sua Carreira e Seu Negócio
marcelgsantos
0
100
PHPで TLSのプロトコルを実装してみる
higaki_program
0
740
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
230
Running Swift without an OS
kishikawakatsumi
0
240
テレメトリーシグナルが導くパフォーマンス最適化 / Performance Optimization Driven by Telemetry Signals
seike460
PRO
2
220
Don't Prompt Harder, Structure Better
kitasuke
0
320
存在論的プログラミング: 時間と存在を記述する
koriym
5
800
実践CRDT
tamadeveloper
0
260
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
230
Spec Driven Development: The End Of Vibe Coding | DevLand 2026
danielsogl
PRO
0
110
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Git: the NoSQL Database
bkeepers
PRO
432
67k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Testing 201, or: Great Expectations
jmmastey
46
8.1k
Unsuck your backbone
ammeep
672
58k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.4k
Code Review Best Practice
trishagee
74
20k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
150
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ӡ༻পͰ͢….
͓͠·͍