Memcached

Easy to use, distributed, in-memory key-value store for use as a high performance cache or session store.

What is Memcached?

Memcached is an easy-to-use, high-performance, in-memory data store. It offers a mature, scalable, open-source solution for delivering sub-millisecond response times making it useful as a cache or session store. Memcached is a popular choice for powering real-time applications in Web, Mobile Apps, Gaming, Ad-Tech, and E-Commerce.

What is Memcached?

How does Memcached work?

Unlike databases that store data on disk or SSDs, Memcached keeps its data in memory. By eliminating the need to access disks, in-memory key-value stores such as Memcached avoid seek time delays and can access data in microseconds. Memcached is also distributed, meaning that it is easy to scale out by adding new nodes. And since Memcached is multithreaded, you can easily scale up compute capacity. As a result of its speed and scalability as well as its simple design, efficient memory management, and API support for most popular languages Memcached is a popular choice for high-performance, large-scale caching use cases.

Benefits of Memcached

Memcached keeps all of its data in the server’s main memory. Unlike databases such as PostgreSQL, Cassandra, and MongoDB which store most of their data on disk or SSDs, in-memory data stores don’t have to make repeated round trips to disk. This allows them to support an order of magnitude more operations and faster response times. The result is – blazing fast performance with sub-millisecond average read and write times and support for millions of operations per second.

Memcached is designed to be simple and generic, making it both powerful and easy to use in application development. Many open-source clients are available for Memcached developers. Supported languages include Java, Python, PHP, C, C++, C#, JavaScript, Node.js, Ruby, Go and many others.

Memcached’s distributed and multithreaded architecture makes it easy to scale. You can split your data among a number of nodes, enabling you to scale out capacity by adding new nodes to your cluster. Moreover, since Memcached is multithreaded, it can use multiple cores on a given node. This makes it simple to scale up compute capacity. With Memcached you can build highly scalable distributed caching solutions designed to provide fast and consistent performance.

Memcached is a mature open-source project supported by a vibrant community. Applications such as WordPress and Django support using Memcached to improve performance. There’s no vendor or technology lock in since Memcached is open standards based, supports open data formats, and features a rich set of clients.

Use cases

Caching

Memcached is a great choice for implementing a high performance in-memory cache to decrease data access latency, increase throughput, and ease the load off your back-end systems. Memcached can serve cached items in less than a millisecond, and enables you to easily and cost effectively scale for higher loads. Memcached is popular for database query results caching, session caching, web page caching, API caching, and caching of objects such as images, files, and metadata.

Session store

Memcached as an in-memory data store is a popular choice among application developers to store and manage session data for internet-scale applications in cases where persistence is not critical. Memcached is designed to provide the sub-millisecond latency and scale required to manage session data such as user profiles, credentials, and session state.

Language support

Memcached supports most leading programming languages and protocols, including:

Python

Java

PHP

C/C#/C++

Perl

Go

Ruby

JavaScript

Node.js

ASCII protocol

Binary protocol

TCP & UDP protocols

Redis vs. Memcached

Redis and Memcached are the two most popular in-memory key-value data stores. Memcached is designed for simplicity while Redis offers a rich set of features that make it effective for a wide range of use cases. Understand the differences between the two engines to decide which solution better meets your needs. Learn more about Redis vs. Memcached

Fully managed Memcached on AWS

Amazon offers a fully managed Memcached service, Amazon ElastiCache for Memcached:

  • Easily set up, operate, and scale Memcached deployments in the cloud. Failed nodes are automatically detected and replaced.
  • Take advantage of cost-efficient and resizable hardware capacity.
  • Use an ElasitCache Memcached Cluster Client with Auto Discovery to speed up application development by simplifying node management.