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
85
1
Share
Caching, why not?
Highload meetup: talks by Megogo, 2015
dkovalenko
July 11, 2015
Other Decks in Technology
See All in Technology
Ruby::Boxでできること、Refinementsでできること
joker1007
3
380
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
1.9k
もりもり新機能を一挙紹介! AgentCoreに入門して、AWS上にAIエージェントを構築しよう
minorun365
PRO
6
750
脅威をエンジニアリングの糧にして:恐怖を乗り越えた先にあったもの / Turn threats into fuel for engineering: what lay beyond overcoming fear
nrslib
1
390
美味しいスイスチーズを作ろう🧀🐭
taigamikami
1
230
はじめてのDatadog
kairim0
0
270
AI活用を推進するために ファインディが下した、一つの小さな決断
starfish719
0
240
JEP 522 Deep Dive - G1 GC同期コスト削減によるスループット向上を徹底検証&解説
tabatad
1
730
イベントストーミングとKiroの仕様駆動開発で実現する要件の認識合わせプロセス
syobochim
7
1.1k
チームで実践する AI-DLC 思考の軌跡を残すチェックポイント設計
belongadmin
0
2.4k
Databricks における 生成AIガバナンスの実践
taka_aki
1
300
地元にいないローカルオーガナイザーの立ち回り
uvb_76
1
460
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1.1k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
380
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
560
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
240
KATA
mclloyd
PRO
35
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
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?