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
77
Caching, why not?
Highload meetup: talks by Megogo, 2015
dkovalenko
July 11, 2015
Tweet
Share
Other Decks in Technology
See All in Technology
戰略轉變:從建構 AI 代理人到發展可擴展的技能生態系統
appleboy
0
190
Databricks Free Editionで始めるLakeflow SDP
taka_aki
0
110
これまでのネットワーク運用を変えるかもしれないアプデをおさらい
hatahata021
2
150
ソフトとハード両方いけるデータ人材の育て方
waiwai2111
1
290
チームで安全にClaude Codeを利用するためのプラクティス / team-claude-code-practices
tomoki10
7
3.3k
Models vs Bounded Contexts for Domain Modularizati...
ewolff
0
190
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
旬のブリと旬の技術で楽しむ AI エージェント設計開発レシピ
chack411
1
260
Scrum Guide Expansion Pack が示す現代プロダクト開発への補完的視点
sonjin
0
670
純粋なイミュータブルモデルを設計してからイベントソーシングと組み合わせるDeciderの実践方法の紹介 /Introducing Decider Pattern with Event Sourcing
tomohisa
1
1.1k
Eight Engineering Unit 紹介資料
sansan33
PRO
0
6.2k
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
120
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
600
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Side Projects
sachag
455
43k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
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?