Cover by Dan Sanderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Chapter 9. The Memory Cache

Durable data storage requires a storage medium that retains data through power loss and system restarts. Today’s medium of choice is the hard drive, a storage device composed of circular platters coated with magnetic material on which data is encoded. The platters spin at a constant rate while a sensor moves along the radius, reading and writing bits on the platters as they travel past. Reading or writing a specific piece of data requires a disk seek to position the sensor at the proper radius and wait for the platter to rotate until the desired data is underneath. Hard drives are astonishingly fast, all things considered, but for web applications, disk seeks can be costly. Fetching an entity from the datastore by key can take time on the order of tens of milliseconds.

Most high-performance web applications use a memory cache. A memory cache uses a volatile storage medium, usually the RAM of the cache machines, for very fast read and write access to values. A distributed memory cache provides scalable, consistent temporary storage for distributed systems, so many processes can access the same data. Because memory is volatile—it gets erased during an outage—the cache is not useful for long-term storage, or even short-term primary storage for important data. But it’s excellent as a secondary system for fast access to data also kept elsewhere, such as the datastore. It’s also sufficient as global high-speed memory for some uses.

The App Engine distributed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required