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
Caching, why not?
Search
dkovalenko
July 11, 2015
Technology
1
65
Caching, why not?
Highload meetup: talks by Megogo, 2015
dkovalenko
July 11, 2015
Tweet
Share
Other Decks in Technology
See All in Technology
可視化により内部品質をあげるAIドキュメントリバース/20240910 Hiromitsu Akiba
shift_evolve
0
230
サーバー管理しないサーバーサービスManaged DevOps Pool
kkamegawa
0
140
テスト”ケース”駆動開発 で手戻りをなくそう
ryohma0510
0
330
サプライチェーン攻撃に備える
ryunen344
0
290
Privacy Sandbox on Android / DroidKaigi 2024
7pairs
1
270
あなたの知らないiOS開発の世界
recruitengineers
PRO
3
180
サーバレスでモバイルアプリ開発! NTTコム「ビジネスdアプリ」のアーキテクチャ / The architecture of business d app
nttcom
12
250
AIで変わるテスト自動化:最新ツールの多様なアプローチ/ 20240910 Takahiro Kaneyama
shift_evolve
0
240
Jetpack Compose Modifier 徹底解説 / Jetpack Compose Modifier
wiroha
0
200
持続可能なソフトウェア開発を支える『GitHub CI/CD実践ガイド』
tmknom
8
1.4k
言葉は感情の近似値である。その感情と言葉の誤差を最小化しよう ~コミュニケーションにおけるアナログ/デジタル変換の課題に立ち向かう~
nktamago
0
240
Discovering AI Models
picardparis
4
3.9k
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1365
200k
Adopting Sorbet at Scale
ufuk
73
8.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
190
16k
The Invisible Customer
myddelton
119
13k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
41
6.5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
Music & Morning Musume
bryan
46
6k
Facilitating Awesome Meetings
lara
49
6k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
What's in a price? How to price your products and services
michaelherold
242
11k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
Why Our Code Smells
bkeepers
PRO
334
56k
Transcript
Caching, why not? Highload Meetup: talks by Megogo
About me • Dmitriy Kovalenko @dkovalenko_fun • TeamLead @ x2sy:
Megogo • Actively using: Scala, php • Also: Clojure, golang
About us • > 4 million users every day •
> 30000 hours of video content • Web, iOS, Android, SmartTV, OTT Boxes • CIS, Baltics, Europe
Agenda • Caching across tiers: 1. Browser 2. Frontend server/proxy
3. Application • Cache infrastructure • Microservices and caching
Speedup your Application
None
None
• Cache-control • Max-Age, S-Max-Age (seconds) • Expires • ETag
(If-None-Match) Headers
None
Use CDN, Carl! • Move your Images, JS, CSS ->
CDN • Assets minifying, response gzipping
Use your Frontend/ Cacher/ Proxy
Reverse proxy • Varnish Cache • Nginx • Use your
cache store directly (CouchDB, Memcached) • Split your page, think about SSI/ESI includes
None
frontend server caching pros: • High speed • Zero overhead
for application • Usually can be applied without application change
frontend server caching cons: • Hard to debug • Hard
to get right • Changes in application needs additional synchronization
Application cache pros: • Much controllable than frontend cache •
Can use Application context • Swapping implementations in not a problem
Problems to think about • Key selection, Cache Tags •
Invalidation schema • Cold start/full flush • Dogpile effect • Embedded or External • Local or Distibuted
<?php $data = $cache->get('some_key'); if ($data === false) { $data
= getFromDB(); $cache->set($data); } return $data;
Cache slam problem
Eviction strategies • LRU • LFU • FIFO • Lifetime
Cache in cluster CP DB Service 2 WEB API Service
2
Going further with Microservices
There are only two hard things in Computer Science: cache
invalidation and naming things. ! -- Phil Karlton
Solutions • Nodes list • Shared/Distributed caches • Master invalidates
slaves • Queue • Cache cleaner • ETag FTW!
None
None
None
None
None
None
Great caching is like great sex. It hides all the
real problems. ! @vivekhaldar Questions?