SlideShare a Scribd company logo
Advanced Microservices Caching
Patterns
Natan Silnitsky - Backend Infra TL, Wix.com
November 30, December 1-2, 2021
@NSilnitsky
@NSilnitsky
Caching Patterns
Advanced Microservices
Caching Patterns
Natan Silnitsky
Backend Infra TL,
Wix.com
natansil.com twitter@NSilnitsky linkedin/natansilnitsky github.com/natansil
@NSilnitsky
Caching Patterns
>200 Million registered users from 190 countries
@NSilnitsky
@NSilnitsky
Caching Patterns
Rebecca, Wix Stores
Stores
Checkout
Service
* issues
@NSilnitsky
@NSilnitsky
Caching Patterns
1. Get app
identification
2. Start
WIX APP
MARKET
Rebecca, Wix Stores
HTTP
Stores
Checkout
Service
@NSilnitsky
@NSilnitsky
Caching Patterns
WIX APP
MARKET
Rebecca, Wix Stores 1. Get app
identification
2. Start
Stores
Checkout
Service
Unreliable Requests
* still available
@NSilnitsky
@NSilnitsky
Caching Patterns
Alex, Wix Stores
Store
Catalog
Stores
Catalog
Service
retrieve
@NSilnitsky
@NSilnitsky
Caching Patterns
Alex, Wix Stores
Store
Catalog
Stores
Catalog
Service
Request Overload
DB latency and
failure increase
@NSilnitsky
@NSilnitsky
No Cache - Increase in
- loading and response
- Network costs
- DB failure
Caching Patterns
* traffic grows
@NSilnitsky
@NSilnitsky
With Cache -
- reduce latency
- reduce the needed scale
- improve reliability
Caching Patterns
* DB is unavailable
@NSilnitsky
When & how to Cache
Examples from 2000 microservices of various use cases
Caching Patterns
#1
high risk/cost
of network
failure
Like caching
external critical
configuration
data.
* S3 backed
@NSilnitsky
When & how to Cache
Examples from 2000 microservices of various use cases
Caching Patterns
#1
high risk/cost
of network
failure
Like caching
external critical
configuration
data.
#2
To improve
average latency
for data layer
access
DynamoDB +
CDC +
LRU cache.
@NSilnitsky
When & how to Cache
Examples from 2000 microservices of various use cases
Caching Patterns
#1
high risk/cost
of network
failure
Like caching
external critical
configuration
data.
#2
To improve
average latency
for data layer
access
DynamoDB +
CDC +
LRU cache.
#3
Some very high
external traffic
cases
Caches are very
important -
cache before
the service.
@NSilnitsky
When & how to Cache
Examples from 2000 microservices of various use cases
Caching Patterns
#1
high risk/cost
of network
failure
Like caching
external critical
configuration
data.
#2
To improve
average latency
for data layer
access
DynamoDB +
CDC +
LRU cache.
#3
Some very high
external traffic
cases
Caches are very
important -
cache before
the service.
#4
When NOT to -
young products
Don’t cache
prematurely
@NSilnitsky
Agenda 3 Caching Patterns:
1. S3 backed static cache
2. DynamoDB+CDC based cache
3. HTTP Reverse Proxy cache
Caching Patterns
@NSilnitsky
Agenda 3 Caching Patterns:
1. S3 backed static cache
2. DynamoDB+CDC based cache
3. HTTP Reverse Proxy cache
Caching Patterns
@NSilnitsky
Service
WIX APP
MARKET
Caching Patterns
for Unreliable Requests
@NSilnitsky
Service
WIX APP
MARKET
Caching Patterns
On Init - Fetch app defs
Koboshi /
Remote Data Fetcher
@NSilnitsky
Service
WIX APP
MARKET
Caching Patterns
Koboshi /
Remote Data Fetcher
Local
cache
or
AWS S3
@NSilnitsky
Service
WIX APP
MARKET
Caching Patterns
Koboshi /
Remote Data Fetcher
Local
cache AWS S3
or
+ Retry
@NSilnitsky
@NSilnitsky
Caching Patterns
Cache Type Cache Size Best For Not For
Read-through cache
Before the 3rd party service
Data has to
fit into memory
External source
of static configuration
Dynamically
updating data
@NSilnitsky
Next 3 Caching Patterns:
1. S3 backed static cache
2. DynamoDB+CDC based cache
3. HTTP Reverse Proxy cache
Caching Patterns
@NSilnitsky
Caching Patterns
Store
Catalog
Stores
Catalog
Service
for Request Overload
Read + Writes
Browser
HTTP
* slower interaction
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Cached KV Store
2. put
Store
Catalog
1. Write
V1
K1
V1
K2 K3 K8 K9
V1 V2 V1
head End
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Cached KV Store
1. get
Store
Catalog
2. Read
on miss
V1
K1
V1
K2 K3 K8 K9
V1 V2 V1
head End
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Cached KV Store
LRU Cache
put
Amazon
DynamoDB
put
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Cross-DC Data
replication & conflict
resolution
Amazon
DynamoDB
Cache
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Amazon
DynamoDB
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
Event
K1- V2 is updated
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
K1
----
V1
K2
----
V1
K1
-----
V2
K3
----
V1
K4
----
V1
K5
----
V1
CDC Topic
Keeps a SEQUENCE OF EVENTS
Kafka Broker
Cache
@NSilnitsky
Caching Patterns
Stores
Catalog
Service
Amazon
DynamoDB
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
Event
K1- V2 is updated
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
5
0 1 2 3 4
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
0 1 2 3 4 5
K1
----
V1
K2
----
V1
K1
-----
V2
K3
----
V1
K4
----
V1
K5
----
V1
CDC Topic
Keeps a SEQUENCE OF EVENTS
Kafka Broker
Consumer
(Consumes
from)
Cached KV Store
V1
K1
V1
K2 K3 K8 K9
V1 V2 V1
head End
@NSilnitsky
Cache
Caching Patterns
Warm up
Take most
recent events
Amazon
DynamoDB
CDC Topic
Kafka Broker
Stores
Catalog
Service
@NSilnitsky
Cache
Caching Patterns
Warm up (compact)
Take ALL
Up to date events
Amazon
DynamoDB
CDC Topic
Kafka Broker
Stores
Catalog
Service
@NSilnitsky
@NSilnitsky
Caching Patterns
Cache Type Cache Size Best For Not For
Cache-Aside
Before the DB
No limitation on DB data size
LRU cache size is configurable
Make DB read access faster
for “popular” values
Highly critical application
startup information
@NSilnitsky
Next 3 Caching Patterns:
S3 backed static cache
DynamoDB+CDC based cache
HTTP Reverse Proxy cache
Caching Patterns
@NSilnitsky
Caching Patterns
@NSilnitsky
Caching Patterns
Site
Renderer
Service
DNS
resolution
Load
Balancers
* simplified flow
Wix DC
Varnish
cache
* open source
@NSilnitsky
Caching Patterns
DNS
resolution
Load
Balancers
* simplified flow
Varnish
cache
Kafka Broker
Site Published
Purge request
(SiteId)
Site
Editor
Service
Site
Renderer
Service
Wix DC
@NSilnitsky
Caching Patterns
DNS
resolution
Load
Balancers
* simplified flow
Varnish
cache
Kafka Broker
Site Published
Purge request
(SiteId)
Purge
ETag: SiteId
Site
Editor
Service
Varnish
Purger
Service
Site
Renderer
Service
Wix DC
@NSilnitsky
@NSilnitsky
Varnish
cache
Size limit depends on the configured
Storage backends:
1. malloc is memory based — so the size is limited by
(more) expensive memory cost
2. file is memory-backed-by-disk based — which is
limited by less expensive disk cost, but can cause
performance penalty due to fragmentation…
Caching Patterns
@NSilnitsky
@NSilnitsky
Varnish
cache
Size limit depends on the configured
Storage backends:
1. malloc is memory based — so the size is limited by
(more) expensive memory cost
2. file is memory-backed-by-disk based — which is
limited by less expensive disk cost, but can cause
performance penalty due to fragmentation…
3. Massive Storage Engine (MSE) — also backed by file,
but has a “fragmentation proof algorithm.” part of
Varnish Cache Plus (paying customers only).
Caching Patterns
@NSilnitsky
@NSilnitsky
Caching Patterns
Cache Type Cache Size Best For Not For
Read-through
before the app
Depends on storage
backend
Improving latency for “stable”
HTTP responses
Hard to invalidate
aggregated data
@NSilnitsky
@NSilnitsky
Caching Patterns
Choose
Cache Pattern
Is your data crucial
for startup?
Is your data highly
dynamic?
No
Yes
S3 Persisted data cache
@NSilnitsky
@NSilnitsky
Caching Patterns
Choose
Cache Pattern
Is your data crucial
for startup?
Is your data highly
dynamic?
S3 Persisted data cache
No
Yes
Is your data highly
dynamic?
Yes
No
DynamoDB backed
cache / Redis
Yes
@NSilnitsky
@NSilnitsky
Caching Patterns
Choose
Cache Pattern
Is your data crucial
for startup?
Is your data highly
dynamic?
S3 Persisted data cache
No
Yes
Is your data highly
dynamic?
Yes
No
External clients &
easy invalidation?
No
DynamoDB backed
cache / Redis
Varnish cache /
CDN
Yes
No
Yes
@NSilnitsky
https://medium.com/wix-engineering/4-microservices-caching-pattern
s-at-wix-b4dfee1ae22f
The blog post
Caching Patterns
@NSilnitsky
A Java/Scala high-level SDK for Apache Kafka.
github.com/wix/greyhound
Caching Patterns
0.2 is out!
@NSilnitsky
@NSilnitsky
Thank
You!
👉 slideshare.net/NatanSilnitsky
Any questions?
natansil.com twitter@NSilnitsky linkedin/natansilnitsky github.com/natansil
Caching Patterns
@NSilnitsky
@NSilnitsky
Q&A
natansil.com twitter@NSilnitsky linkedin/natansilnitsky github.com/natansil
👉 slideshare.net/NatanSilnitsky
Any questions?

More Related Content

PDF
Battle Tested Event-Driven Patterns for your Microservices Architecture - Ris...
PDF
Advanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
PDF
Advanced Caching Patterns used by 2000 microservices - Api World
PDF
Advanced Microservices Caching Patterns - Devoxx UK
PDF
Jax london - Battle-tested event-driven patterns for your microservices archi...
PDF
Kafka based Global Data Mesh at Wix
PPTX
Standardizing Microservice Management With a Service Mesh
PDF
Polyglot, Fault Tolerant Event-Driven Programming with Kafka, Kubernetes and ...
Battle Tested Event-Driven Patterns for your Microservices Architecture - Ris...
Advanced Caching Patterns used by 2000 microservices - Devoxx Ukraine
Advanced Caching Patterns used by 2000 microservices - Api World
Advanced Microservices Caching Patterns - Devoxx UK
Jax london - Battle-tested event-driven patterns for your microservices archi...
Kafka based Global Data Mesh at Wix
Standardizing Microservice Management With a Service Mesh
Polyglot, Fault Tolerant Event-Driven Programming with Kafka, Kubernetes and ...

What's hot (20)

PPTX
Spring Cloud: API gateway upgrade & configuration in the cloud
PDF
8 Lessons Learned from Using Kafka in 1500 microservices - confluent streamin...
PDF
How We Fixed Our MongoDB Problems
PDF
Connecting Kafka Across Multiple AWS VPCs
PPTX
Conceptos Avanzados 1: Motores de Almacenamiento
PDF
MongoDB Europe 2016 - Star in a Reasonably Priced Car - Which Driver is Best?
PPTX
Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...
PPTX
Introducing Stitch
PDF
Capacity Planning Your Kafka Cluster | Jason Bell, Digitalis
PDF
MongoDB Europe 2016 - Ops Manager and Cloud Manager
PPTX
MongoDB 3.4 webinar
PDF
MongoDB .local London 2019: Modern Data Backup and Recovery from On-premises ...
PDF
Encode polkadot club
PDF
Understanding Apache Kafka® Latency at Scale
PPTX
Powering Microservices with Docker, Kubernetes, Kafka, & MongoDB
PPTX
AWS Lambda, Step Functions & MongoDB Atlas Tutorial
PDF
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
PPTX
Microservices in the Apache Kafka Ecosystem
PPTX
Using Compass to Diagnose Performance Problems in Your Cluster
PDF
MongoDB Europe 2016 - Building WiredTiger
Spring Cloud: API gateway upgrade & configuration in the cloud
8 Lessons Learned from Using Kafka in 1500 microservices - confluent streamin...
How We Fixed Our MongoDB Problems
Connecting Kafka Across Multiple AWS VPCs
Conceptos Avanzados 1: Motores de Almacenamiento
MongoDB Europe 2016 - Star in a Reasonably Priced Car - Which Driver is Best?
Powering Microservices with MongoDB, Docker, Kubernetes & Kafka – MongoDB Eur...
Introducing Stitch
Capacity Planning Your Kafka Cluster | Jason Bell, Digitalis
MongoDB Europe 2016 - Ops Manager and Cloud Manager
MongoDB 3.4 webinar
MongoDB .local London 2019: Modern Data Backup and Recovery from On-premises ...
Encode polkadot club
Understanding Apache Kafka® Latency at Scale
Powering Microservices with Docker, Kubernetes, Kafka, & MongoDB
AWS Lambda, Step Functions & MongoDB Atlas Tutorial
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
Microservices in the Apache Kafka Ecosystem
Using Compass to Diagnose Performance Problems in Your Cluster
MongoDB Europe 2016 - Building WiredTiger
Ad

Similar to Advanced Caching Patterns used by 2000 microservices - Code Motion (20)

PDF
Don’t give up, You can... Cache!
PDF
Ehcache Architecture, Features And Usage Patterns
PPTX
Selecting the right cache framework
PPTX
Big data cloud architecture
PDF
Caching for Microservices Architectures: Session II - Caching Patterns
PDF
Sizing Splunk SmartStore - Spend Less and Get More Out of Splunk
PDF
Building event-driven (Micro)Services with Apache Kafka
PDF
Caching Patterns
PPTX
Scalable Resilient Web Services In .Net
PDF
Scalable Smart Caching for Spring Developers
PPTX
Distributed Cache with dot microservices
PPTX
Data Caching Evolution - the SafePeak deck from webcast 2014-04-24
PDF
Cloud-native Data: Every Microservice Needs a Cache
PDF
Caching for Microservices Architectures: Session I
PDF
Battle-tested event-driven patterns for your microservices architecture - Sca...
PPT
Building scalable and reliable websites
ODP
Caching and tuning fun for high scalability
PDF
Battle Tested Event-Driven Patterns for your Microservices Architecture
PPTX
Scaling Cloud Apps
PDF
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Don’t give up, You can... Cache!
Ehcache Architecture, Features And Usage Patterns
Selecting the right cache framework
Big data cloud architecture
Caching for Microservices Architectures: Session II - Caching Patterns
Sizing Splunk SmartStore - Spend Less and Get More Out of Splunk
Building event-driven (Micro)Services with Apache Kafka
Caching Patterns
Scalable Resilient Web Services In .Net
Scalable Smart Caching for Spring Developers
Distributed Cache with dot microservices
Data Caching Evolution - the SafePeak deck from webcast 2014-04-24
Cloud-native Data: Every Microservice Needs a Cache
Caching for Microservices Architectures: Session I
Battle-tested event-driven patterns for your microservices architecture - Sca...
Building scalable and reliable websites
Caching and tuning fun for high scalability
Battle Tested Event-Driven Patterns for your Microservices Architecture
Scaling Cloud Apps
Spring One 2 GX 2014 - CACHING WITH SPRING: ADVANCED TOPICS AND BEST PRACTICES
Ad

More from Natan Silnitsky (20)

PDF
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
PDF
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
PDF
Reinventing Microservices Efficiency and Innovation with Single-Runtime
PDF
Async Excellence Unlocking Scalability with Kafka - Devoxx Greece
PDF
Wix Single-Runtime - Conquering the multi-service challenge
PDF
WeAreDevs - Supercharge Your Developer Journey with Tiny Atomic Habits
PDF
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
PDF
Effective Strategies for Wix's Scaling challenges - GeeCon
PDF
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
PDF
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
PDF
DevSum - Lessons Learned from 2000 microservices
PDF
GeeCon - Lessons Learned from 2000 microservices
PDF
Migrating to Multi Cluster Managed Kafka - ApacheKafkaIL
PDF
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
PDF
BuildStuff - Lessons Learned from 2000 Event Driven Microservices
PDF
Lessons Learned from 2000 Event Driven Microservices - Reversim
PDF
Devoxx Ukraine - Kafka based Global Data Mesh
PDF
Devoxx UK - Migrating to Multi Cluster Managed Kafka
PDF
Dev Days Europe - Kafka based Global Data Mesh at Wix
PDF
Kafka Summit London - Kafka based Global Data Mesh at Wix
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Integration Ignited Redefining Event-Driven Architecture at Wix - EventCentric
Reinventing Microservices Efficiency and Innovation with Single-Runtime
Async Excellence Unlocking Scalability with Kafka - Devoxx Greece
Wix Single-Runtime - Conquering the multi-service challenge
WeAreDevs - Supercharge Your Developer Journey with Tiny Atomic Habits
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Effective Strategies for Wix's Scaling challenges - GeeCon
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Workflow Engines & Event Streaming Brokers - Can they work together? [Current...
DevSum - Lessons Learned from 2000 microservices
GeeCon - Lessons Learned from 2000 microservices
Migrating to Multi Cluster Managed Kafka - ApacheKafkaIL
Wix+Confluent Meetup - Lessons Learned from 2000 Event Driven Microservices
BuildStuff - Lessons Learned from 2000 Event Driven Microservices
Lessons Learned from 2000 Event Driven Microservices - Reversim
Devoxx Ukraine - Kafka based Global Data Mesh
Devoxx UK - Migrating to Multi Cluster Managed Kafka
Dev Days Europe - Kafka based Global Data Mesh at Wix
Kafka Summit London - Kafka based Global Data Mesh at Wix

Recently uploaded (20)

PPTX
Transform Your Business with a Software ERP System
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPT
Introduction Database Management System for Course Database
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
history of c programming in notes for students .pptx
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
System and Network Administraation Chapter 3
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
CHAPTER 2 - PM Management and IT Context
Transform Your Business with a Software ERP System
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Odoo Companies in India – Driving Business Transformation.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
ManageIQ - Sprint 268 Review - Slide Deck
Wondershare Filmora 15 Crack With Activation Key [2025
Understanding Forklifts - TECH EHS Solution
How to Migrate SBCGlobal Email to Yahoo Easily
Upgrade and Innovation Strategies for SAP ERP Customers
Introduction Database Management System for Course Database
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Adobe Illustrator 28.6 Crack My Vision of Vector Design
history of c programming in notes for students .pptx
VVF-Customer-Presentation2025-Ver1.9.pptx
How to Choose the Right IT Partner for Your Business in Malaysia
Internet Downloader Manager (IDM) Crack 6.42 Build 41
System and Network Administraation Chapter 3
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
CHAPTER 2 - PM Management and IT Context

Advanced Caching Patterns used by 2000 microservices - Code Motion