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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
640
APIテストとは?
nagix
0
170
ITエンジニアを取り巻く環境とキャリアパス / A career path for Japanese IT engineers
takatama
4
1.8k
「コーディング」しない人のための Claude Code 入門 ChatGPT の次の一歩 — 業務に組み込む 育成・共有・自動化
rfdnxbro
2
1.1k
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.8k
速さだけじゃない! VoidZero ツールが移行先に選ばれる理由
mizdra
PRO
6
730
サイバーセキュリティ概論 / Introduction to Cybersecurity
ks91
PRO
0
120
Agentic ERPをどう設計するか ー 受発注エージェントを動かす、現場の知見と設計思想ー
recerqainc
1
660
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
17
16k
トークン数だけでは測れない — Claude Code 組織展開の効果検証から学んだこと
makikub
0
110
先取りMaven4 ~16年ぶりのメジャーアップデート、その進化とは?~
ogiwarat
0
130
Javaで学ぶSOLID原則
negima
1
270
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
310
Claude Code のすすめ
schroneko
67
220k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
570
Building a Scalable Design System with Sketch
lauravandoore
463
34k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
The Spectacular Lies of Maps
axbom
PRO
1
780
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
230
Believing is Seeing
oripsolob
1
140
Game over? The fight for quality and originality in the time of robots
wayneb77
1
180
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
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?