WIPIVERSE

Memcached

Memcached is a free and open-source, high-performance, distributed memory object caching system. It is a general-purpose in-memory key-value store designed to speed up dynamic web applications by caching data and objects in RAM, thereby reducing the number of times an external data source—such as a database or API—must be read.

Overview

Memcached functions as a distributed cache that stores small chunks of arbitrary data (strings, objects, and similar payloads) in memory. It is built on a client–server architecture in which servers maintain a key–value associative array; clients populate and query this array. Keys can be up to 250 bytes long, and individual values are limited to a maximum size of 1 megabyte. The system allows memory from one server to be pooled and made accessible across multiple nodes, enabling applications running on many servers to share a unified virtual cache.

History

Memcached was originally developed by Brad Fitzpatrick in 2003 for LiveJournal, a blogging platform he had created. It was developed at Danga Interactive to help LiveJournal serve its growing number of users and reduce database load. The software was subsequently released under the Revised BSD license and became an open-source project. It was written primarily in the C programming language. Over time, development transitioned to a community of contributors coordinated through the official memcached.org website.

Architecture and Operation

Memcached uses a hash table to store its data in memory. Its internal memory management is based on a slab allocation system, in which memory is divided into slabs of varying chunk sizes to reduce fragmentation and improve efficiency. When memory is exhausted, the system evicts data using a least-recently-used (LRU) eviction policy, discarding cached items that have not been accessed recently.

Deployments typically place memcached servers either on the same machines as web servers (using otherwise idle memory) or on dedicated cache nodes. A consistent hashing mechanism is commonly used by client libraries to determine which server stores a given key, allowing the cache to scale horizontally as more servers are added.

Usage

Memcached is widely used in large-scale dynamic websites and web applications to reduce database load and improve response times. It has been adopted by major Internet companies and platforms, including companies such as Facebook and Twitter at various points in their infrastructure. It remains a commonly cited option within system design literature for caching strategies, and is frequently compared to other caching and data-store technologies such as Redis.

Distribution and Licensing

Memcached is distributed under the Revised BSD license, making it permissively licensed free software. It runs on Unix-like operating systems, including Linux and macOS, and is also available on Windows through community ports. Client libraries exist for numerous programming languages, including C, C++, Java, Python, PHP, Ruby, Perl, Go, and others.

External Links

  • Official website: https://www.memcached.org/
  • Documentation: http://docs.memcached.org/
Browse

More topics to explore

    Browse all articles