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
80
Caching, why not?
Highload meetup: talks by Megogo, 2015
dkovalenko
July 11, 2015
Tweet
Share
Other Decks in Technology
See All in Technology
内製AIチャットボットで学んだDatadog LLM Observability活用術
mkdev10
0
130
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
1
650
Scrumは歪む — 組織設計の原理原則
dashi
0
200
"作る"から"使われる"へ:Backstage 活用の現在地
sbtechnight
0
190
Sansanでの認証基盤内製化と移行
sansantech
PRO
0
570
Yahoo!ショッピングのレコメンデーション・システムにおけるML実践の一例
lycorptech_jp
PRO
1
220
わからなくて良いなら、わからなきゃだめなの?
kotaoue
1
370
詳解 強化学習 / In-depth Guide to Reinforcement Learning
prinlab
0
280
形式手法特論:SMT ソルバで解く認可ポリシの静的解析 #kernelvm / Kernel VM Study Tsukuba No3
ytaka23
1
530
Windows ファイル共有(SMB)を再確認する
murachiakira
PRO
0
120
OCI技術資料 : コンピュート・サービス 概要
ocise
4
54k
WebアクセシビリティをCI/CDで担保する ― axe DevTools × Playwright C#実践ガイド
tomokusaba
2
170
Featured
See All Featured
Visualization
eitanlees
150
17k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Exploring anti-patterns in Rails
aemeredith
2
290
A Soul's Torment
seathinner
5
2.5k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Speed Design
sergeychernyshev
33
1.6k
Between Models and Reality
mayunak
2
240
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
230
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
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?