SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
FIFO Queues
are all You Need for Cache Eviction
Juncheng Y
a
ng
Software cache and eviction
• Ubiquitous deployments of software caches
• page cache, block cache, database cache
• key-value cache, object cache…
• Cache metrics
• efficiency / effectiveness: miss ratio
• throughput and scalability: requests/sec
• simplicity
• A core component of cache design: eviction
2
Cachelib Pelikan
A long history of research centered around LRU
•Least-recently-used (LRU)
• maintain objects in a queue with last-access order
• update metadata (with locking) on each read request
• Problems
• not scalable
• not scan-resistant
3
A long history of research centered around LRU
•Improve LRU’s efficiency
• add more techniques/queues/metrics: LIRS[SIGMETRICS’02], LRU-K[SIGMOD’93], 2Q[VLDB’94], MQ[ATC’01],
ARC[FAST’03], TinyLFU[TOS’17], LRB[NSDI’20], CACHEUS[FAST’21]…
• sacrifice throughput and/or scalability
•Improve LRU’s throughput and scalability
• reduce #operations/locks per-request: relaxed LRU, CLOCK variants[NSDI’13], FrozenHot[Eurosys’23]
• conventional wisdom: sacrifice efficiency, our finding[HotOS’23] shows not true
•State-of-the-arts: tradeoff between efficiency and throughput
4
[HotOS’23] FIFO queues
can be better than LRU
An alternative: FIFO eviction algorithm
•First-in-first-out (FIFO)
•simpler
•fewer metadata
•less computation
•more scalable
•flash-friendly
5
The only drawback:
FIFO has a high miss ratio
Can we design an efficient
FIFO-based algorithm?
6
Observation
• One-hit wonder: objects appeared once in the sequence
• Zipfian workloads: One-hit-wonder ratio decreases with sequence length (measured in #obj)
• Why short sequences? A cache starts eviction after seeing a short request sequence
More one-hit wonders than you would have expected
A B A C B A D A B C B A E C B D
A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
request
time
start time end time
sequence length
(# objects)
# one-hit wonder one-hit wonder ratio
1 17 5 1 (E) 20%
1 7 4 2 (C, D) 50%
1 4 3 2 (B, C) 66%
Observation
• One-hit wonder: objects appeared once in the sequence
• Zipfian workloads: One-hit-wonder ratio decreases with sequence length (measured in #obj)
• Why short sequences? A cache starts eviction after seeing a short request sequence
More one-hit wonders than you would have expected
8
the one-hit-wonder ratio of week-long traces at 10% length:
72% (mean on 6594 traces)
Observation
9
   



 



 


LRU cache running Twitter workload
   



 



 


LRU cache running MSR workload
most objects in the cache are one-hit wonders
Simple, Sc
a
l
a
ble c
a
ching with three St
a
tic FIFO queues
S3-FIFO Design
10
https://s3fifo.com
S3-FIFO design
Simple, Sc
a
l
a
ble eviction
a
lgorithm with three St
a
tic FIFO queues
11
main FIFO (90% space)
small
ghost
struct object {
…
uint8_t cnt:2;
}
*using 1-bit
f
l
a
g
a
lso is suf
f
icient for most worklo
a
ds
if cnt == 0
evict
else
reinsert
cnt--
3 on eviction
if not in ghost, else
2 on cache miss
if cnt = 1, else
3 on eviction
cnt++
1 on cache hit
S3-FIFO features
• Simple and robust: static queues
• Fast: no metadata update for most requests
• Scalable: no lock
• Tiny metadata: 2 bits
• Flash-friendly: sequential writes
12
Implementation: one, two or three FIFO-queues
S3-FIFO evaluation
13
Evaluation setup
• Data
• 14 datasets, 6594 traces from Twitter, Meta, Microsoft, Wikimedia, Tencent, Alibaba, major CDNs…
• 848 billion requests, 60 billion objects
• collected between 2007 and 2023
• block, key-value, object caches
• Platform
• libCacheSim, cachelib
• CloudLab with 1 million core·hours
• Data and software are all open-sourced
• Metric
• miss ratio reduction from FIFO
• throughput in Mops/sec
14
Efficiency
Miss r
a
tio reduction distribution
a
cross
a
ll tr
a
ces
15
better
.
.
-
Efficiency
Miss r
a
tio reduction distribution
a
cross
a
ll tr
a
ces
16
better
.
.
-
Efficiency
Miss r
a
tio reduction distribution
a
cross
a
ll tr
a
ces
17
better
.
.
-
Efficiency
Miss r
a
tio reduction distribution
a
cross
a
ll tr
a
ces
18
More efficient than state-of-the-art algorithms, up to 72% lower miss ratio than LRU
better
.
.
-
0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40
Miss ratio reduction from FIFO
fiu (block)
MSR (block)
CloudPhysics (block)
Systor (block)
Tencent (block)
Alibaba (block)
Social Network KV
Meta KV
Twitter KV
CDN1
CDN2
TencentPhoto CDN
Meta CDN
Wikimedia CDN
ARC 2Q TinyLFU-0.1 LIRS CACHEUS LHD
Efficiency
Me
a
n miss r
a
tio reduction on e
a
ch d
a
t
a
set
better
19
S3-FIFO yet to be shown
)00 1). 2 1).- .
)2 .
.
.2 (40) 0 .
401. .
- -1 .
) .
. ) 13.
1
3)11
- -1 (.1.
1
) ) )
)-4
Efficiency
Me
a
n miss r
a
tio reduction on e
a
ch d
a
t
a
set
• efficient: the best algorithm or is close to the best
• robust: the best on 10 of the 14 datasets
better
Throughput and scalability
Zipf worklo
a
ds
• the fastest on a single
thread
• more scalable than
optimized LRU, 6x higher
throughput
• close to Segcache[NSDI’21]
) (
)
)(
(
(
better
21
More in the paper
• Why S3-FIFO is effective
• Implication for flash cache
• Byte miss ratio results
• Impact of FIFO sizes
• What if we replace FIFO with LRU
22
Takeaway
• Cache workloads exhibit high one-hit-wonder ratio
• most objects in the cache are not re-accessed before being evicted
• critical to remove the one-hit wonders early
• S3-FIFO: simple, scalable caching with three static FIFO queues
• reinsertion to keep popular objects, a small FIFO queue to quickly filter out one-hit wonders
• adoption
• implemented at Google, VMware, Redpanda, etc.
• many libraries for Python, Javascript, Golang, Rust, C++ are available on GitHub
23
https://s3fifo.com
juncheny@cs.cmu.edu
24

Más contenido relacionado

Similar a Data Infra Meetup | FIFO Queues are All You Need for Cache Eviction

Optimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
Optimal Strategies for Large Scale Batch ETL Jobs with Emma TangOptimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
Optimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
Databricks
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
Chester Chen
 

Similar a Data Infra Meetup | FIFO Queues are All You Need for Cache Eviction (20)

Automating the Hunt for Non-Obvious Sources of Latency Spreads
Automating the Hunt for Non-Obvious Sources of Latency SpreadsAutomating the Hunt for Non-Obvious Sources of Latency Spreads
Automating the Hunt for Non-Obvious Sources of Latency Spreads
 
Project Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare MetalProject Tungsten: Bringing Spark Closer to Bare Metal
Project Tungsten: Bringing Spark Closer to Bare Metal
 
Circonus: Design failures - A Case Study
Circonus: Design failures - A Case StudyCirconus: Design failures - A Case Study
Circonus: Design failures - A Case Study
 
Sayyad slides ase13_v4
Sayyad slides ase13_v4Sayyad slides ase13_v4
Sayyad slides ase13_v4
 
Optimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
Optimal Strategies for Large Scale Batch ETL Jobs with Emma TangOptimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
Optimal Strategies for Large Scale Batch ETL Jobs with Emma Tang
 
C* Summit 2013: Time is Money Jake Luciani and Carl Yeksigian
C* Summit 2013: Time is Money Jake Luciani and Carl YeksigianC* Summit 2013: Time is Money Jake Luciani and Carl Yeksigian
C* Summit 2013: Time is Money Jake Luciani and Carl Yeksigian
 
Optimal Strategies for Large-Scale Batch ETL Jobs
Optimal Strategies for Large-Scale Batch ETL JobsOptimal Strategies for Large-Scale Batch ETL Jobs
Optimal Strategies for Large-Scale Batch ETL Jobs
 
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
SF Big Analytics & SF Machine Learning Meetup: Machine Learning at the Limit ...
 
Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015
Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015
Architecture of Flink's Streaming Runtime @ ApacheCon EU 2015
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
 
John adams talk cloudy
John adams   talk cloudyJohn adams   talk cloudy
John adams talk cloudy
 
Chicago Flink Meetup: Flink's streaming architecture
Chicago Flink Meetup: Flink's streaming architectureChicago Flink Meetup: Flink's streaming architecture
Chicago Flink Meetup: Flink's streaming architecture
 
Performance and predictability
Performance and predictabilityPerformance and predictability
Performance and predictability
 
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
AWS re:Invent presentation: Unmeltable Infrastructure at Scale by Loggly
 
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
Nikita Abdullin - Reverse-engineering of embedded MIPS devices. Case Study - ...
 
Grow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM StackGrow and Shrink - Dynamically Extending the Ruby VM Stack
Grow and Shrink - Dynamically Extending the Ruby VM Stack
 
Resilience at Extreme Scale
Resilience at Extreme ScaleResilience at Extreme Scale
Resilience at Extreme Scale
 
Apache Pulsar Overview
Apache Pulsar OverviewApache Pulsar Overview
Apache Pulsar Overview
 
MeetBSD2014 Performance Analysis
MeetBSD2014 Performance AnalysisMeetBSD2014 Performance Analysis
MeetBSD2014 Performance Analysis
 
The Spectre of Meltdowns
The Spectre of MeltdownsThe Spectre of Meltdowns
The Spectre of Meltdowns
 

Más de Alluxio, Inc.

AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 

Más de Alluxio, Inc. (20)

AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Optimizing Data Access for Analytics And AI with Alluxio
Optimizing Data Access for Analytics And AI with AlluxioOptimizing Data Access for Analytics And AI with Alluxio
Optimizing Data Access for Analytics And AI with Alluxio
 
Speed Up Presto at Uber with Alluxio Caching
Speed Up Presto at Uber with Alluxio CachingSpeed Up Presto at Uber with Alluxio Caching
Speed Up Presto at Uber with Alluxio Caching
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/MLBig Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
Big Data Bellevue Meetup | Enhancing Python Data Loading in the Cloud for AI/ML
 
Alluxio Monthly Webinar | Why a Multi-Cloud Strategy Matters for Your AI Plat...
Alluxio Monthly Webinar | Why a Multi-Cloud Strategy Matters for Your AI Plat...Alluxio Monthly Webinar | Why a Multi-Cloud Strategy Matters for Your AI Plat...
Alluxio Monthly Webinar | Why a Multi-Cloud Strategy Matters for Your AI Plat...
 
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...Alluxio Monthly Webinar | Five Disruptive Trends that Every  Data & AI Leader...
Alluxio Monthly Webinar | Five Disruptive Trends that Every Data & AI Leader...
 
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio EdgeData Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
Data Infra Meetup | Accelerate Your Trino/Presto Queries - Gain the Alluxio Edge
 
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the CloudData Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
Data Infra Meetup | Accelerate Distributed PyTorch/Ray Workloads in the Cloud
 
Data Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet ReaderData Infra Meetup | ByteDance's Native Parquet Reader
Data Infra Meetup | ByteDance's Native Parquet Reader
 
Data Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage EvolutionData Infra Meetup | Uber's Data Storage Evolution
Data Infra Meetup | Uber's Data Storage Evolution
 
Alluxio Monthly Webinar | Why NFS/NAS on Object Storage May Not Solve Your AI...
Alluxio Monthly Webinar | Why NFS/NAS on Object Storage May Not Solve Your AI...Alluxio Monthly Webinar | Why NFS/NAS on Object Storage May Not Solve Your AI...
Alluxio Monthly Webinar | Why NFS/NAS on Object Storage May Not Solve Your AI...
 
AI Infra Day | Accelerate Your Model Training and Serving with Distributed Ca...
AI Infra Day | Accelerate Your Model Training and Serving with Distributed Ca...AI Infra Day | Accelerate Your Model Training and Serving with Distributed Ca...
AI Infra Day | Accelerate Your Model Training and Serving with Distributed Ca...
 
AI Infra Day | The AI Infra in the Generative AI Era
AI Infra Day | The AI Infra in the Generative AI EraAI Infra Day | The AI Infra in the Generative AI Era
AI Infra Day | The AI Infra in the Generative AI Era
 
AI Infra Day | Hands-on Lab: CV Model Training with PyTorch & Alluxio on Kube...
AI Infra Day | Hands-on Lab: CV Model Training with PyTorch & Alluxio on Kube...AI Infra Day | Hands-on Lab: CV Model Training with PyTorch & Alluxio on Kube...
AI Infra Day | Hands-on Lab: CV Model Training with PyTorch & Alluxio on Kube...
 

Último

JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
Max Lee
 

Último (20)

AI Hackathon.pptx
AI                        Hackathon.pptxAI                        Hackathon.pptx
AI Hackathon.pptx
 
SQL Injection Introduction and Prevention
SQL Injection Introduction and PreventionSQL Injection Introduction and Prevention
SQL Injection Introduction and Prevention
 
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
 
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Sourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing ManufacturerSourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing Manufacturer
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit MilanWorkshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
Workshop: Enabling GenAI Breakthroughs with Knowledge Graphs - GraphSummit Milan
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdfThe Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
The Evolution of Web App Testing_ An Ultimate Guide to Future Trends.pdf
 
What is an API Development- Definition, Types, Specifications, Documentation.pdf
What is an API Development- Definition, Types, Specifications, Documentation.pdfWhat is an API Development- Definition, Types, Specifications, Documentation.pdf
What is an API Development- Definition, Types, Specifications, Documentation.pdf
 
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Lessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdfLessons Learned from Building a Serverless Notifications System.pdf
Lessons Learned from Building a Serverless Notifications System.pdf
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 

Data Infra Meetup | FIFO Queues are All You Need for Cache Eviction

  • 1. FIFO Queues are all You Need for Cache Eviction Juncheng Y a ng
  • 2. Software cache and eviction • Ubiquitous deployments of software caches • page cache, block cache, database cache • key-value cache, object cache… • Cache metrics • efficiency / effectiveness: miss ratio • throughput and scalability: requests/sec • simplicity • A core component of cache design: eviction 2 Cachelib Pelikan
  • 3. A long history of research centered around LRU •Least-recently-used (LRU) • maintain objects in a queue with last-access order • update metadata (with locking) on each read request • Problems • not scalable • not scan-resistant 3
  • 4. A long history of research centered around LRU •Improve LRU’s efficiency • add more techniques/queues/metrics: LIRS[SIGMETRICS’02], LRU-K[SIGMOD’93], 2Q[VLDB’94], MQ[ATC’01], ARC[FAST’03], TinyLFU[TOS’17], LRB[NSDI’20], CACHEUS[FAST’21]… • sacrifice throughput and/or scalability •Improve LRU’s throughput and scalability • reduce #operations/locks per-request: relaxed LRU, CLOCK variants[NSDI’13], FrozenHot[Eurosys’23] • conventional wisdom: sacrifice efficiency, our finding[HotOS’23] shows not true •State-of-the-arts: tradeoff between efficiency and throughput 4 [HotOS’23] FIFO queues can be better than LRU
  • 5. An alternative: FIFO eviction algorithm •First-in-first-out (FIFO) •simpler •fewer metadata •less computation •more scalable •flash-friendly 5 The only drawback: FIFO has a high miss ratio
  • 6. Can we design an efficient FIFO-based algorithm? 6
  • 7. Observation • One-hit wonder: objects appeared once in the sequence • Zipfian workloads: One-hit-wonder ratio decreases with sequence length (measured in #obj) • Why short sequences? A cache starts eviction after seeing a short request sequence More one-hit wonders than you would have expected A B A C B A D A B C B A E C B D A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 request time start time end time sequence length (# objects) # one-hit wonder one-hit wonder ratio 1 17 5 1 (E) 20% 1 7 4 2 (C, D) 50% 1 4 3 2 (B, C) 66%
  • 8. Observation • One-hit wonder: objects appeared once in the sequence • Zipfian workloads: One-hit-wonder ratio decreases with sequence length (measured in #obj) • Why short sequences? A cache starts eviction after seeing a short request sequence More one-hit wonders than you would have expected 8 the one-hit-wonder ratio of week-long traces at 10% length: 72% (mean on 6594 traces)
  • 9. Observation 9 LRU cache running Twitter workload LRU cache running MSR workload most objects in the cache are one-hit wonders
  • 10. Simple, Sc a l a ble c a ching with three St a tic FIFO queues S3-FIFO Design 10 https://s3fifo.com
  • 11. S3-FIFO design Simple, Sc a l a ble eviction a lgorithm with three St a tic FIFO queues 11 main FIFO (90% space) small ghost struct object { … uint8_t cnt:2; } *using 1-bit f l a g a lso is suf f icient for most worklo a ds if cnt == 0 evict else reinsert cnt-- 3 on eviction if not in ghost, else 2 on cache miss if cnt = 1, else 3 on eviction cnt++ 1 on cache hit
  • 12. S3-FIFO features • Simple and robust: static queues • Fast: no metadata update for most requests • Scalable: no lock • Tiny metadata: 2 bits • Flash-friendly: sequential writes 12 Implementation: one, two or three FIFO-queues
  • 14. Evaluation setup • Data • 14 datasets, 6594 traces from Twitter, Meta, Microsoft, Wikimedia, Tencent, Alibaba, major CDNs… • 848 billion requests, 60 billion objects • collected between 2007 and 2023 • block, key-value, object caches • Platform • libCacheSim, cachelib • CloudLab with 1 million core·hours • Data and software are all open-sourced • Metric • miss ratio reduction from FIFO • throughput in Mops/sec 14
  • 15. Efficiency Miss r a tio reduction distribution a cross a ll tr a ces 15 better . . -
  • 16. Efficiency Miss r a tio reduction distribution a cross a ll tr a ces 16 better . . -
  • 17. Efficiency Miss r a tio reduction distribution a cross a ll tr a ces 17 better . . -
  • 18. Efficiency Miss r a tio reduction distribution a cross a ll tr a ces 18 More efficient than state-of-the-art algorithms, up to 72% lower miss ratio than LRU better . . -
  • 19. 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 Miss ratio reduction from FIFO fiu (block) MSR (block) CloudPhysics (block) Systor (block) Tencent (block) Alibaba (block) Social Network KV Meta KV Twitter KV CDN1 CDN2 TencentPhoto CDN Meta CDN Wikimedia CDN ARC 2Q TinyLFU-0.1 LIRS CACHEUS LHD Efficiency Me a n miss r a tio reduction on e a ch d a t a set better 19 S3-FIFO yet to be shown
  • 20. )00 1). 2 1).- . )2 . . .2 (40) 0 . 401. . - -1 . ) . . ) 13. 1 3)11 - -1 (.1. 1 ) ) ) )-4 Efficiency Me a n miss r a tio reduction on e a ch d a t a set • efficient: the best algorithm or is close to the best • robust: the best on 10 of the 14 datasets better
  • 21. Throughput and scalability Zipf worklo a ds • the fastest on a single thread • more scalable than optimized LRU, 6x higher throughput • close to Segcache[NSDI’21] ) ( ) )( ( ( better 21
  • 22. More in the paper • Why S3-FIFO is effective • Implication for flash cache • Byte miss ratio results • Impact of FIFO sizes • What if we replace FIFO with LRU 22
  • 23. Takeaway • Cache workloads exhibit high one-hit-wonder ratio • most objects in the cache are not re-accessed before being evicted • critical to remove the one-hit wonders early • S3-FIFO: simple, scalable caching with three static FIFO queues • reinsertion to keep popular objects, a small FIFO queue to quickly filter out one-hit wonders • adoption • implemented at Google, VMware, Redpanda, etc. • many libraries for Python, Javascript, Golang, Rust, C++ are available on GitHub 23 https://s3fifo.com juncheny@cs.cmu.edu
  • 24. 24