DEV Community

Dang Hoang Nhu Nguyen
Dang Hoang Nhu Nguyen

Posted on

[BTY] Day 1: 7 Reasons Not to Put an External Cache in Front of Your Database | ScyllaDB

I've passed through a few days relaxing from the Tet holiday (aka. Lunar New Year). So now, we start again from the beginning!

All information is extracted from this article: https://www.infoq.com/vendorcontent/show.action?vcr=207f2eed-6333-49ed-802e-5e5e3567f4e9

Disclaimer: I've not used ScyllaDB yet.

My key takeaways

Traditional side caching vs transparent caching (NEW)
Image description

The Linux page cache
The Linux page cache, also called disk cache, improves operating system performance by storing page-size chunks of files in memory to save on expensive disk seeks. The Linux kernel treats files as 4KB chunks by default. This speeds up performance, but only when data is 4KB or larger. The problem is that many common database operations involve data smaller than 4KB. In those cases, Linux’s 4KB minimum leads to high read amplification.

The seven fails of external caches

  1. An external cache adds latency
  2. An external cache adds needless expense
  3. External caching decreases availability
  4. Application complexity — your application needs to handle more cases
  5. External caching ruins database caching
  6. External caching complicates data security
  7. External caching ignores the database’s intelligence and resource

Scylla's embedded cache

The Scylla NoSQL database offers a better approach to caching, one that addresses the significant problems covered above, while also delivering the performance gains that caching promises.

  • Scylla uses a special-purpose cache instead of Linux default cache. It can dynamically tune itself to any workload and always controls their eviction and memory footprint.
  • Scylla can dynamically balance the different types of caches stored.
  • Once data is no longer cached in memory, Scylla will generate a continuation task to read the data asynchronously from the disk using direct memory access (DMA), which allows hardware subsystems to access main system memory independent of CPU.
  • The C++ Seastar framework on which Scylla is built will execute the continuation task in a μsec (1 million tasks/core/sec) and will rush to run the next task. There’s no blocking, heavyweight context switch, waste, or tuning.
  • Because Scylla has a very efficient internal cache it obviates the need for a separate external cache, making for a more efficient, reliable, secure and cost-effective unified solution.

Top comments (0)