Data - Cache

Data System Architecture

About

In computer science, a data cache is a component that aims to:

  • improve performance
  • reduce load on the server.

The cache will:

  • store transparently a request response
  • and use it to for later requests until a cache time limit has been reached

The data that is stored within a cache might be:

  • values that have been computed earlier
  • or duplicates of original values that are stored elsewhere.

Properties

Cache Request:

Cache Store

Goal

Which information is loaded into cache depends on algorithms and certain assumptions about programming code. The goal of the cache system is to ensure that the application has the next bit of data it will need already loaded into cache by the time it goes looking for it (also called a cache hit).

Cache hit, cache miss

If requested data is contained in the cache, a cache hit occurs and this request can be served by simply reading the cache, which is comparably faster.

Otherwise, a cache miss occurs and the data has to be recomputed or fetched from its original storage location, which is comparably slower.

Hence, the more requests can be served from the cache the better the overall system performance is.

A cache is transparent

As opposed to a buffer, which is managed explicitly by a client, a cache stores data transparently: This means that a client who is requesting data from a system is not aware that the cache exists, which is the origin of the name cache (from French “cacher”, to conceal).

Validity Cache Time vs Business Level

This section is about data processing cache where data needs to be aggregated.

Architecture Level Data Latency
Raw Source Immediate
Real Time Cache Seconds
Business Process Minutes
Business Management Day
Business Lead Week, Month, Year

Key

Whenever a cache receives a request, it needs to decide:

  • whether it has a copy of this exact request already saved and can reply with that,
  • if it needs to forward the request to the server.

Caches tackle this problem using the concept of cache keys that identifies uniquely the resource.

See HTTP cache key

Implemententation

1)

Cachedir tag to identify a cache directory

To avoid backing up, archiving, copying, or moving cache directories, you can add the file CACHEDIR.TAG to identify a directory as containing cache data.

Example: All CACHEDIR.TAG have the same content

Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by (application name).
# For information about cache directory tags, see:
#	http://www.brynosaurus.com/cachedir/

See: https://bford.info/cachedir/





Discover More
Data System Architecture
(Data|State|Operand) Management and Processing

This section is and state management as opposed to code. System that manages data are called database. In a computer, there is two kinds of byte instruction byte and data byte. This section is...
Browser
Browser - Custom cache

If the default HTTP browser cache mechanism is not sufficient, you may implement your own cache system on top of fetching library with service worker.
Cpu System Load
CPU - (System) Load Average

The performance load metrics in the context of a system. This CPU metrics is often called a CPU Load average but this is really a system load average as Unix refers it as the run-queue length. Ie: ...
Cpu Moore Law Transistor
CPU - CPU Cache (L1, L2, L3)

A CPU cache is a cache used by the central processing unit of a computer to reduce the average time to access memory. When the processor needs to read from or write to a location in main memory, it first...
Data System Architecture
Cache - LRU (Least Recently Used)

LRU (or least recently used) is a cache algorithm that will discard the least recently used items first when the cache becomes full. (ie the things you haven't used for a while).
Data System Architecture
Collection - HashMap (Hash table)

A hash map is an implementation of a map that stores the data in buckets. The distribution of the data to a bucket is via the hash value of the key map entry (hence a HashMap). A hash map is used...
Map Of Internet 1973
DNS - Cache

A DNS cache is a cache of the result of a DNS lookup (query). The cache is implemented in a DNS library by the resolver. You need to configure the resolver to configure or purge your cache. ...
Map Of Internet 1973
Data Cache - Time to Live (TTL) or hop limit

The TTL is the maximum timespan of data in a cache. Once the timespan has elapsed, data is discarded or revalidated. A DNS record has a TTL attached A HTTP cache with the max-age and s-max-age...
Card Puncher Data Processing
Data Storage - The Buffer Cache (File System Cache)

All data accessed from files on the system that are performed through the use of read() and write() system calls, pass through the file system buffer cache. This buffer cache greatly speeds up disk access...
HTTP Caches - All the web caches layer explained on one page

Cache is an important tool for data performance but may be creepy when controlling data consistency. Why am I seeing an old version, is it my code or is it the cache ? This article lists all the possible...



Share this page:
Follow us:
Task Runner