SlideShare a Scribd company logo
1 of 28
Download to read offline
Cache in Chromium 
Disk Cache & Overall cache flow
Chang W. Doh 
<hi> </hi> 
GDG Korea WebTech Organizer 
HTML5Rocks/KO Contributor/Coordinator
Before stepping into Cache: 
Network stack
Network Stack: 
What’s ‘Network Stack’? 
● A mostly single-threaded cross-platform 
library primarily for resource fetching 
○ URLRequest 
■ represents the request for a URL 
○ URLRequestContext 
■ contains all the associated contexts to fullfill 
the ‘URL request’ 
● e.g. cookies, host resolver, cache
Before stepping into Cache: 
● Some code layouts 
○ /net/base 
Network stack 
■ shared utilities for /net modules 
○ /net/disk_cache 
■ Cache for web resources 
○ /net/url_request 
■ URLRequest, URLRequestContext, ...
Typical request-flow
HttpCache Cache 
check (aka Disk Cache) 
HttpCache::Transaction 
not exist 
notify 
notify 
Cache hit!
Disk Cache: 
(a.k.a. Cache)
DiskCache: 
● Cache 
What’s DiskCache? 
○ Stores resources fetched from the web 
○ A part of ‘/net’ 
■ location: /net/disk_cache 
■ This means ‘DiskCache’ will controll cache-flows 
for network fetches. 
● NOTE: 
○ Android use ‘Simple cache’. 
■ location: /net/disk_cache/simple
DiskCache: 
● Main characteristics: 
Characteristics 
○ The cache should not grow unbounded 
■ Algorithm to decide when removing old entries 
○ Not critical to loose some data 
■ But discarding whole cache should be minimized 
○ Access should be possible to use sync or 
async operations 
○ Design should avoid ‘cache trashing’
DiskCache: 
● Main characteristics: 
Characteristics 
○ Should be possible to remove a entry from 
the cache 
■ and keep working with that entry while same time inaccessible to other requests 
○ Shouldn’t be using explicit multithread sync 
■ Always called from the same thread 
■ However, callbacks must be issued by message 
loop for avoiding reentrancy
DiskCache: 
External interfaces 
● /net/disk_cache/disk_cache.h 
● 2 Interfaces 
○ disk_cache::Backend 
■ manages entries on the cache 
○ disk_cache::Entry 
■ handles operations specific to a given resource
External interfaces: 
● An entry is identified by its key 
○ e.g. http://www.google.com/favicon.ico 
● Once an entry is created, the data is stored in 
separate chunks or data streams: 
○ HTTP headers 
○ Actual resource data 
● Index for the required stream is an argument to 
methods: 
○ Entry::ReadData 
○ Entry::WriteData 
Backend
Very Simple Cache 
(a.k.a. Simple Cache)
Simple cache: 
What is “Simple Cache”? 
● Proposed to a new backend for diskcache 
○ Conforming to the interface in Disk Cache 
○ Very simple 
■ Using 1 file per cache entry + index file 
■ Dealing with I/O bottlenecks
Comparison to 
Blockfile Backend 
?
Simple cache: 
Benefits and goals 
● Comparison to blockfile cache 
○ More resilent under corruption from the 
system crash 
■ Periodcally flushes its entire index 
■ Swaps index in atomically 
■ After system crash, will starts with the stale 
cache 
● NOTE: With the blockfile cache, chrome will drops 
whole cache by default
Simple cache: 
Benefits and goals 
● Comparison to blockfile cache (cont’d) 
○ Doesn’t delay launching network requests 
■ Elimination of delay factors 
● No context switching 
● Not blocks disk I/O before using network 
■ Blockfile has (AVR) 14~25ms delay on requests 
● On Android, slower flash controllers make delays significantly slower.
Simple cache: 
Benefits and goals 
● Comparison to blockfile cache (cont’d) 
○ Lower resident set pressure & fewer IO ops. 
■ Disk format has 
● 256~512B per entry records 
● + rankings & index information(~100B) per entry 
● Not all entries that are heavily used contiguously 
■ Simple cache 
● stores only SMALLNUM bytes per entry in memory 
● doesn’t access the disk where not required
Simple cache: 
Benefits and goals 
● Comparison to blockfile cache (cont’d) 
○ Simpler 
■ Shorter and easier via explicitly avoiding 
implementation of filesystem than blockfile’s
Simple cache: 
Non-goals; Simple cache is 
● Not a log structed cache system 
○ I/O performs by Simple cache is mostly 
sequential. But NOT log structed 
■ If it is, it means “filesystem that itself is log 
structed.” 
● Not a filesystem 
○ Disk cache delegates filesystem. 
■ means “Simple cache uses abstract interface 
of Disk Cache instead implementing its own 
filesystem”.
Simple cache: 
● Entry hash 
Structure on Disk 
○ Hash with 40 bit SHA-2 of url 
○ 2 entries with same EH can’t be stored 
● Stored in single directory 
○ ONE index file 
○ Each entry stored in a single file 
■ named by HexEntryHash_StreamNumber
Simple cache: 
● A file ‘00index’ 
Structure on Disk 
○ contains data for initializing memory index 
● Index (on memory) 
○ used for faster cache performance 
○ consists of entry hashes for records & simple 
eviction information
Simple cache: 
Structure on Disk 
● Formats of entry file 
○ Simple file header 
magic_number version key_length key_hash 
○ Simple file EOF 
final_magic_number flags data_crc32 stream_size 
○ Simple File sparse range header 
sparse_magic_number offset length data_crc32
Term: 
Sparse file
Simple cache: 
Implementation 
● I/O thread operations 
○ public API is called on the I/O thread 
○ The index is updated in the I/O thread 
● Worker pool operations 
○ All I/O operations are performed async on 
the worker pool. 
○ Cache will keep a pool of new entries ready 
to move into final place.
Simple cache: 
Implementation 
● Index flushing & consistency checking 
○ The index is flushed on 
■ shutdown 
■ periodically 
● Operation without index 
○ can operate without the IO thread index by 
directly opening files in the directory. 
○ for avoiding startup speeds & I/O costs
References 
[1] Disk Cache 
[2] Disk Cache 3.0 
[3] Very Simple Cache 
[4] Multi-process Resource Loading 
[5] Network Stack 
[6] Network Stack Use in Chromium

More Related Content

What's hot

Ccna sv2 instructor_ppt_ch2
Ccna sv2 instructor_ppt_ch2Ccna sv2 instructor_ppt_ch2
Ccna sv2 instructor_ppt_ch2SalmenHAJJI1
 
공간정보거점대학 PostGIS 고급과정
공간정보거점대학 PostGIS 고급과정공간정보거점대학 PostGIS 고급과정
공간정보거점대학 PostGIS 고급과정JungHwan Yun
 
Android media codec 사용하기
Android media codec 사용하기Android media codec 사용하기
Android media codec 사용하기Taehwan kwon
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069William Lee
 
HKG18-203 - Overview of Linaro DRM
HKG18-203 - Overview of Linaro DRMHKG18-203 - Overview of Linaro DRM
HKG18-203 - Overview of Linaro DRMLinaro
 
Zenodo and linking Open Science - Nielsen Lars Holm
Zenodo and linking Open Science - Nielsen Lars HolmZenodo and linking Open Science - Nielsen Lars Holm
Zenodo and linking Open Science - Nielsen Lars HolmOpenAIRE
 
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ..."Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...Edge AI and Vision Alliance
 
Android Tools for Qualcomm Snapdragon Processors
Android Tools for Qualcomm Snapdragon Processors Android Tools for Qualcomm Snapdragon Processors
Android Tools for Qualcomm Snapdragon Processors Qualcomm Developer Network
 
[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기Juhee Kang
 
Python Programlama Diline Giriş - Güncelleme 2018
Python Programlama Diline Giriş - Güncelleme 2018Python Programlama Diline Giriş - Güncelleme 2018
Python Programlama Diline Giriş - Güncelleme 2018Murat KARA
 
오픈 소스 GIS와 OSGeo
오픈 소스 GIS와 OSGeo오픈 소스 GIS와 OSGeo
오픈 소스 GIS와 OSGeoSANGHEE SHIN
 
Rsa in CTF
Rsa in CTFRsa in CTF
Rsa in CTFSoL ymx
 
DDoS Saldırı Analizi - DDoS Forensics
DDoS Saldırı Analizi - DDoS ForensicsDDoS Saldırı Analizi - DDoS Forensics
DDoS Saldırı Analizi - DDoS ForensicsBGA Cyber Security
 
Embedded linux system development (slides)
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)Jaime Barragan
 
Introduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technologyIntroduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technology義洋 顏
 
Redirecionamento, pipes e processos linux
Redirecionamento, pipes e processos   linuxRedirecionamento, pipes e processos   linux
Redirecionamento, pipes e processos linuxFábio dos Reis
 
Monitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsMonitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsBen Mildren
 

What's hot (20)

Ccna sv2 instructor_ppt_ch2
Ccna sv2 instructor_ppt_ch2Ccna sv2 instructor_ppt_ch2
Ccna sv2 instructor_ppt_ch2
 
공간정보거점대학 PostGIS 고급과정
공간정보거점대학 PostGIS 고급과정공간정보거점대학 PostGIS 고급과정
공간정보거점대학 PostGIS 고급과정
 
Android media codec 사용하기
Android media codec 사용하기Android media codec 사용하기
Android media codec 사용하기
 
Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069Introdunction to Network Management Protocols - SNMP & TR-069
Introdunction to Network Management Protocols - SNMP & TR-069
 
HKG18-203 - Overview of Linaro DRM
HKG18-203 - Overview of Linaro DRMHKG18-203 - Overview of Linaro DRM
HKG18-203 - Overview of Linaro DRM
 
Zenodo and linking Open Science - Nielsen Lars Holm
Zenodo and linking Open Science - Nielsen Lars HolmZenodo and linking Open Science - Nielsen Lars Holm
Zenodo and linking Open Science - Nielsen Lars Holm
 
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ..."Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
 
Android Tools for Qualcomm Snapdragon Processors
Android Tools for Qualcomm Snapdragon Processors Android Tools for Qualcomm Snapdragon Processors
Android Tools for Qualcomm Snapdragon Processors
 
[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기[ko] Kernel Networking Stack 진입 장벽 허물기
[ko] Kernel Networking Stack 진입 장벽 허물기
 
Onboard Automation with EEM
Onboard Automation with EEM Onboard Automation with EEM
Onboard Automation with EEM
 
Python Programlama Diline Giriş - Güncelleme 2018
Python Programlama Diline Giriş - Güncelleme 2018Python Programlama Diline Giriş - Güncelleme 2018
Python Programlama Diline Giriş - Güncelleme 2018
 
오픈 소스 GIS와 OSGeo
오픈 소스 GIS와 OSGeo오픈 소스 GIS와 OSGeo
오픈 소스 GIS와 OSGeo
 
Rsa in CTF
Rsa in CTFRsa in CTF
Rsa in CTF
 
DDoS Saldırı Analizi - DDoS Forensics
DDoS Saldırı Analizi - DDoS ForensicsDDoS Saldırı Analizi - DDoS Forensics
DDoS Saldırı Analizi - DDoS Forensics
 
Embedded linux system development (slides)
Embedded linux system development (slides)Embedded linux system development (slides)
Embedded linux system development (slides)
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Introduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technologyIntroduction to ARM big.LITTLE technology
Introduction to ARM big.LITTLE technology
 
File systems for Embedded Linux
File systems for Embedded LinuxFile systems for Embedded Linux
File systems for Embedded Linux
 
Redirecionamento, pipes e processos linux
Redirecionamento, pipes e processos   linuxRedirecionamento, pipes e processos   linux
Redirecionamento, pipes e processos linux
 
Monitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstatsMonitoring IO performance with iostat and pt-diskstats
Monitoring IO performance with iostat and pt-diskstats
 

Similar to Cache in Chromium: Disk Cache

Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopTamas K Lengyel
 
Introduction to containers
Introduction to containersIntroduction to containers
Introduction to containersNitish Jadia
 
Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)Marcos García
 
Mongo nyc nyt + mongodb
Mongo nyc nyt + mongodbMongo nyc nyt + mongodb
Mongo nyc nyt + mongodbDeep Kapadia
 
Socket programming, and openresty
Socket programming, and openrestySocket programming, and openresty
Socket programming, and openrestyTavish Naruka
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaMushfekur Rahman
 
Linux Stammtisch Munich: Ceph - Overview, Experiences and Outlook
Linux Stammtisch Munich: Ceph - Overview, Experiences and OutlookLinux Stammtisch Munich: Ceph - Overview, Experiences and Outlook
Linux Stammtisch Munich: Ceph - Overview, Experiences and OutlookDanny Al-Gaaf
 
Storing your data in the cloud: doing right reversim 2018
Storing your data in the cloud: doing right reversim 2018Storing your data in the cloud: doing right reversim 2018
Storing your data in the cloud: doing right reversim 2018Orit Wasserman
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesDatabricks
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLinaro
 
Toolchain Independent Distributed Compilation
Toolchain Independent Distributed CompilationToolchain Independent Distributed Compilation
Toolchain Independent Distributed CompilationDietmar Hauser
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloudOVHcloud
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersSeravo
 
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, VectorizedData Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, VectorizedHostedbyConfluent
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringShapeBlue
 
Introduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big DataIntroduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big DataJihoon Son
 

Similar to Cache in Chromium: Disk Cache (20)

Caching
CachingCaching
Caching
 
Discoblocks.pptx.pdf
Discoblocks.pptx.pdfDiscoblocks.pptx.pdf
Discoblocks.pptx.pdf
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
 
Introduction to containers
Introduction to containersIntroduction to containers
Introduction to containers
 
Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)Initial presentation of swift (for montreal user group)
Initial presentation of swift (for montreal user group)
 
Mongo nyc nyt + mongodb
Mongo nyc nyt + mongodbMongo nyc nyt + mongodb
Mongo nyc nyt + mongodb
 
Socket programming, and openresty
Socket programming, and openrestySocket programming, and openresty
Socket programming, and openresty
 
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and KibanaBuilding a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
Building a Unified Logging Layer with Fluentd, Elasticsearch and Kibana
 
Linux Stammtisch Munich: Ceph - Overview, Experiences and Outlook
Linux Stammtisch Munich: Ceph - Overview, Experiences and OutlookLinux Stammtisch Munich: Ceph - Overview, Experiences and Outlook
Linux Stammtisch Munich: Ceph - Overview, Experiences and Outlook
 
Storing your data in the cloud: doing right reversim 2018
Storing your data in the cloud: doing right reversim 2018Storing your data in the cloud: doing right reversim 2018
Storing your data in the cloud: doing right reversim 2018
 
Mongodb meetup
Mongodb meetupMongodb meetup
Mongodb meetup
 
The Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization OpportunitiesThe Parquet Format and Performance Optimization Opportunities
The Parquet Format and Performance Optimization Opportunities
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
 
Toolchain Independent Distributed Compilation
Toolchain Independent Distributed CompilationToolchain Independent Distributed Compilation
Toolchain Independent Distributed Compilation
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloud
 
Scaling xtext
Scaling xtextScaling xtext
Scaling xtext
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
 
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, VectorizedData Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
 
Boosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uringBoosting I/O Performance with KVM io_uring
Boosting I/O Performance with KVM io_uring
 
Introduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big DataIntroduction to Apache Tajo: Data Warehouse for Big Data
Introduction to Apache Tajo: Data Warehouse for Big Data
 

More from Chang W. Doh

Exploring what're new in Web for the Natively app
Exploring what're new in Web for the Natively appExploring what're new in Web for the Natively app
Exploring what're new in Web for the Natively appChang W. Doh
 
Kotlin의 코루틴은 어떻게 동작하는가
Kotlin의 코루틴은 어떻게 동작하는가Kotlin의 코루틴은 어떻게 동작하는가
Kotlin의 코루틴은 어떻게 동작하는가Chang W. Doh
 
Hey Kotlin, How it works?
Hey Kotlin, How it works?Hey Kotlin, How it works?
Hey Kotlin, How it works?Chang W. Doh
 
Kotlin, 어떻게 동작하나요
Kotlin, 어떻게 동작하나요Kotlin, 어떻게 동작하나요
Kotlin, 어떻게 동작하나요Chang W. Doh
 
introduction to Web Assembly
introduction to Web Assembly introduction to Web Assembly
introduction to Web Assembly Chang W. Doh
 
PWA Roadshow Seoul - Keynote
PWA Roadshow Seoul - KeynotePWA Roadshow Seoul - Keynote
PWA Roadshow Seoul - KeynoteChang W. Doh
 
PWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSPWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSChang W. Doh
 
CSS 다시 파서 어디에 쓰나
CSS 다시 파서 어디에 쓰나CSS 다시 파서 어디에 쓰나
CSS 다시 파서 어디에 쓰나Chang W. Doh
 
Natively Web App & Service Worker
Natively Web App & Service WorkerNatively Web App & Service Worker
Natively Web App & Service WorkerChang W. Doh
 
초보 개발자를 위한 웹 프론트엔드 개발 101
초보 개발자를 위한 웹 프론트엔드 개발 101초보 개발자를 위한 웹 프론트엔드 개발 101
초보 개발자를 위한 웹 프론트엔드 개발 101Chang W. Doh
 
Service Worker 201 (한국어)
Service Worker 201 (한국어)Service Worker 201 (한국어)
Service Worker 201 (한국어)Chang W. Doh
 
Service Worker 201 (en)
Service Worker 201 (en)Service Worker 201 (en)
Service Worker 201 (en)Chang W. Doh
 
Service Worker 101 (en)
Service Worker 101 (en)Service Worker 101 (en)
Service Worker 101 (en)Chang W. Doh
 
Service Worker 101 (한국어)
Service Worker 101 (한국어)Service Worker 101 (한국어)
Service Worker 101 (한국어)Chang W. Doh
 
What is next for the web
What is next for the webWhat is next for the web
What is next for the webChang W. Doh
 
Instant and offline apps with Service Worker
Instant and offline apps with Service WorkerInstant and offline apps with Service Worker
Instant and offline apps with Service WorkerChang W. Doh
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015Chang W. Doh
 
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기Chang W. Doh
 
Polymer Codelab: Before diving into polymer
Polymer Codelab: Before diving into polymerPolymer Codelab: Before diving into polymer
Polymer Codelab: Before diving into polymerChang W. Doh
 
알아봅시다, Polymer: Web Components & Web Animations
알아봅시다, Polymer: Web Components & Web Animations알아봅시다, Polymer: Web Components & Web Animations
알아봅시다, Polymer: Web Components & Web AnimationsChang W. Doh
 

More from Chang W. Doh (20)

Exploring what're new in Web for the Natively app
Exploring what're new in Web for the Natively appExploring what're new in Web for the Natively app
Exploring what're new in Web for the Natively app
 
Kotlin의 코루틴은 어떻게 동작하는가
Kotlin의 코루틴은 어떻게 동작하는가Kotlin의 코루틴은 어떻게 동작하는가
Kotlin의 코루틴은 어떻게 동작하는가
 
Hey Kotlin, How it works?
Hey Kotlin, How it works?Hey Kotlin, How it works?
Hey Kotlin, How it works?
 
Kotlin, 어떻게 동작하나요
Kotlin, 어떻게 동작하나요Kotlin, 어떻게 동작하나요
Kotlin, 어떻게 동작하나요
 
introduction to Web Assembly
introduction to Web Assembly introduction to Web Assembly
introduction to Web Assembly
 
PWA Roadshow Seoul - Keynote
PWA Roadshow Seoul - KeynotePWA Roadshow Seoul - Keynote
PWA Roadshow Seoul - Keynote
 
PWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPSPWA Roadshow Seoul - HTTPS
PWA Roadshow Seoul - HTTPS
 
CSS 다시 파서 어디에 쓰나
CSS 다시 파서 어디에 쓰나CSS 다시 파서 어디에 쓰나
CSS 다시 파서 어디에 쓰나
 
Natively Web App & Service Worker
Natively Web App & Service WorkerNatively Web App & Service Worker
Natively Web App & Service Worker
 
초보 개발자를 위한 웹 프론트엔드 개발 101
초보 개발자를 위한 웹 프론트엔드 개발 101초보 개발자를 위한 웹 프론트엔드 개발 101
초보 개발자를 위한 웹 프론트엔드 개발 101
 
Service Worker 201 (한국어)
Service Worker 201 (한국어)Service Worker 201 (한국어)
Service Worker 201 (한국어)
 
Service Worker 201 (en)
Service Worker 201 (en)Service Worker 201 (en)
Service Worker 201 (en)
 
Service Worker 101 (en)
Service Worker 101 (en)Service Worker 101 (en)
Service Worker 101 (en)
 
Service Worker 101 (한국어)
Service Worker 101 (한국어)Service Worker 101 (한국어)
Service Worker 101 (한국어)
 
What is next for the web
What is next for the webWhat is next for the web
What is next for the web
 
Instant and offline apps with Service Worker
Instant and offline apps with Service WorkerInstant and offline apps with Service Worker
Instant and offline apps with Service Worker
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015
 
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기
프론트엔드 개발자를 위한 크롬 렌더링 성능인자 이해하기
 
Polymer Codelab: Before diving into polymer
Polymer Codelab: Before diving into polymerPolymer Codelab: Before diving into polymer
Polymer Codelab: Before diving into polymer
 
알아봅시다, Polymer: Web Components & Web Animations
알아봅시다, Polymer: Web Components & Web Animations알아봅시다, Polymer: Web Components & Web Animations
알아봅시다, Polymer: Web Components & Web Animations
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Recently uploaded (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Cache in Chromium: Disk Cache

  • 1. Cache in Chromium Disk Cache & Overall cache flow
  • 2. Chang W. Doh <hi> </hi> GDG Korea WebTech Organizer HTML5Rocks/KO Contributor/Coordinator
  • 3. Before stepping into Cache: Network stack
  • 4. Network Stack: What’s ‘Network Stack’? ● A mostly single-threaded cross-platform library primarily for resource fetching ○ URLRequest ■ represents the request for a URL ○ URLRequestContext ■ contains all the associated contexts to fullfill the ‘URL request’ ● e.g. cookies, host resolver, cache
  • 5. Before stepping into Cache: ● Some code layouts ○ /net/base Network stack ■ shared utilities for /net modules ○ /net/disk_cache ■ Cache for web resources ○ /net/url_request ■ URLRequest, URLRequestContext, ...
  • 7. HttpCache Cache check (aka Disk Cache) HttpCache::Transaction not exist notify notify Cache hit!
  • 9. DiskCache: ● Cache What’s DiskCache? ○ Stores resources fetched from the web ○ A part of ‘/net’ ■ location: /net/disk_cache ■ This means ‘DiskCache’ will controll cache-flows for network fetches. ● NOTE: ○ Android use ‘Simple cache’. ■ location: /net/disk_cache/simple
  • 10. DiskCache: ● Main characteristics: Characteristics ○ The cache should not grow unbounded ■ Algorithm to decide when removing old entries ○ Not critical to loose some data ■ But discarding whole cache should be minimized ○ Access should be possible to use sync or async operations ○ Design should avoid ‘cache trashing’
  • 11. DiskCache: ● Main characteristics: Characteristics ○ Should be possible to remove a entry from the cache ■ and keep working with that entry while same time inaccessible to other requests ○ Shouldn’t be using explicit multithread sync ■ Always called from the same thread ■ However, callbacks must be issued by message loop for avoiding reentrancy
  • 12. DiskCache: External interfaces ● /net/disk_cache/disk_cache.h ● 2 Interfaces ○ disk_cache::Backend ■ manages entries on the cache ○ disk_cache::Entry ■ handles operations specific to a given resource
  • 13. External interfaces: ● An entry is identified by its key ○ e.g. http://www.google.com/favicon.ico ● Once an entry is created, the data is stored in separate chunks or data streams: ○ HTTP headers ○ Actual resource data ● Index for the required stream is an argument to methods: ○ Entry::ReadData ○ Entry::WriteData Backend
  • 14. Very Simple Cache (a.k.a. Simple Cache)
  • 15. Simple cache: What is “Simple Cache”? ● Proposed to a new backend for diskcache ○ Conforming to the interface in Disk Cache ○ Very simple ■ Using 1 file per cache entry + index file ■ Dealing with I/O bottlenecks
  • 17. Simple cache: Benefits and goals ● Comparison to blockfile cache ○ More resilent under corruption from the system crash ■ Periodcally flushes its entire index ■ Swaps index in atomically ■ After system crash, will starts with the stale cache ● NOTE: With the blockfile cache, chrome will drops whole cache by default
  • 18. Simple cache: Benefits and goals ● Comparison to blockfile cache (cont’d) ○ Doesn’t delay launching network requests ■ Elimination of delay factors ● No context switching ● Not blocks disk I/O before using network ■ Blockfile has (AVR) 14~25ms delay on requests ● On Android, slower flash controllers make delays significantly slower.
  • 19. Simple cache: Benefits and goals ● Comparison to blockfile cache (cont’d) ○ Lower resident set pressure & fewer IO ops. ■ Disk format has ● 256~512B per entry records ● + rankings & index information(~100B) per entry ● Not all entries that are heavily used contiguously ■ Simple cache ● stores only SMALLNUM bytes per entry in memory ● doesn’t access the disk where not required
  • 20. Simple cache: Benefits and goals ● Comparison to blockfile cache (cont’d) ○ Simpler ■ Shorter and easier via explicitly avoiding implementation of filesystem than blockfile’s
  • 21. Simple cache: Non-goals; Simple cache is ● Not a log structed cache system ○ I/O performs by Simple cache is mostly sequential. But NOT log structed ■ If it is, it means “filesystem that itself is log structed.” ● Not a filesystem ○ Disk cache delegates filesystem. ■ means “Simple cache uses abstract interface of Disk Cache instead implementing its own filesystem”.
  • 22. Simple cache: ● Entry hash Structure on Disk ○ Hash with 40 bit SHA-2 of url ○ 2 entries with same EH can’t be stored ● Stored in single directory ○ ONE index file ○ Each entry stored in a single file ■ named by HexEntryHash_StreamNumber
  • 23. Simple cache: ● A file ‘00index’ Structure on Disk ○ contains data for initializing memory index ● Index (on memory) ○ used for faster cache performance ○ consists of entry hashes for records & simple eviction information
  • 24. Simple cache: Structure on Disk ● Formats of entry file ○ Simple file header magic_number version key_length key_hash ○ Simple file EOF final_magic_number flags data_crc32 stream_size ○ Simple File sparse range header sparse_magic_number offset length data_crc32
  • 26. Simple cache: Implementation ● I/O thread operations ○ public API is called on the I/O thread ○ The index is updated in the I/O thread ● Worker pool operations ○ All I/O operations are performed async on the worker pool. ○ Cache will keep a pool of new entries ready to move into final place.
  • 27. Simple cache: Implementation ● Index flushing & consistency checking ○ The index is flushed on ■ shutdown ■ periodically ● Operation without index ○ can operate without the IO thread index by directly opening files in the directory. ○ for avoiding startup speeds & I/O costs
  • 28. References [1] Disk Cache [2] Disk Cache 3.0 [3] Very Simple Cache [4] Multi-process Resource Loading [5] Network Stack [6] Network Stack Use in Chromium