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
VS CodeとVimが好きなエンジニアが考えた最強のエディタ
miura55
0
130
SSII2024 [OS1] 自動運転における 重要技術とトレンド紹介
ssii
PRO
0
250
Spring Boot 2.7 から 3.1 への アップグレードに苦労したことと学んだこと
kometsubu
2
240
One screen, many BottomSheets
keithyokoma
0
150
Optimising Scala 3 Build Times - Scala Matsuri
bishabosha
0
120
go get で考慮している ファイルシステムの挙動について
shinnosuke_kishida
3
640
Platform Orchestrators: The Missing Middle of Internal Developer Platforms?
syntasso
1
170
週刊AWSキャッチアップ 生成AI編(2024/5/27週)
minorun365
PRO
5
150
Custom logging with slog Making Logging Fun Again!
masumomo
3
490
データ分析力を高めるSQL研修『SQL Everyone』のご紹介【SQL勉強会 #3】
hikarut
1
180
AWS Storage Gatewayで始めるセキュアなデータ連携 / Secure data linkage with AWS Storage Gateway
yuj1osm
2
180
Go1.21から導入された Go Toolchainの仕組みをまるっと解説
yamatoya
12
3.1k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
14
2.5k
Six Lessons from altMBA
skipperchong
22
3.1k
Testing 201, or: Great Expectations
jmmastey
32
6.8k
Agile that works and the tools we love
rasmusluckow
325
20k
Become a Pro
speakerdeck
PRO
13
4.7k
The Cult of Friendly URLs
andyhume
74
5.8k
Designing the Hi-DPI Web
ddemaree
276
33k
Why Our Code Smells
bkeepers
PRO
331
56k
Principles of Awesome APIs and How to Build Them.
keavy
122
16k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
19
1.7k
Making the Leap to Tech Lead
cromwellryan
126
8.6k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
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?