Skip to main content

Amazon ElastiCache

About Memcached

Memcached is an open source, in-memory, key-value store. It is used for speeding up dynamic web applications with microseconds latency, making it useful as a cache or session store

Unlike databases that store data on disk or SSDs, Memcached keeps its data in memory. By eliminating the need to access disks, Memcached avoid seek time delays and can access data in microseconds. Memcached is distributed meaning that it is easy to scale out by adding new nodes.

Since Memcached is multi-threaded, 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 ideal 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 Python, Java, PHP, C, C++, C#, Perl, Go, Ruby, JavaScript, Node.js, ASCII protocol., Binary protocol, TCP & UDP protocols, and many more.

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.

What are the use cases?

The most popular uses cases for Memcached

Memcached is a great choice for implementing a high performance cache to decrease data access latency, increase throughput, and ease the load off your back-end systems. It can serve frequently requested items in microseconds, and enables you to easily and cost effectively scale for higher loads without growing the costlier database layer. 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.

Memcached is a popular choice to store and manage session data for internet-scale applications in cases where persistence is not critical. Session stores are easy to  create using the Memcached hash table, which can be distributed across multiple nodes. Scaling the session store is as easy as adding a node and updating the clients to take advantage of the new node. Memcached is designed to provide microseconds latency and scale required to manage session data such as user profiles, credentials, and session state.

Memcached can be used to store and manage data related to API rate limiting, enabling the enforcement of usage thresholds in a scalable manner.

What is the difference between Memcached and Redis OSS?

Memcached is fully open source while Redis is licensed under AGPLv3 which is limiting for many organizations due to its copyleft provision. You can learn more about Memcached and Redis OSS engines to decide which solution better meets your needs.

How AWS can support your requirements

AWS offers Amazon ElastiCache for Memcached, a fully managed caching service, which makes it easy to set up, operate, and scale Memcached workloads in the cloud. ElastiCache is fully Memcached-compatible and provides real-time performance for your applications. It has microsecond read and write latency by caching data from primary databases and data stores. 

With ElastiCache Serverless, you can set up a cache in under a minute and instantly scale to applications' demands. ElastiCache for Memcached lets you benefit from a fully managed experience built on open source technology while taking advantage of the years of operational excellence, security, and reliability that ElastiCache provides. As an example, failed nodes are automatically detected and replaced.

ElastiCache for Memcached Cluster Client with Auto Discovery saves you time by simplifying the way an application connects to a Memcached cluster. The client connects to a single cluster endpoint and gets configuration information about other nodes. When nodes are added or removed, the client reconfigures itself to use the most current set of nodes. 

ElastiCache for Memcached is available for free trial with the AWS Free Tier, and you can learn more about Memcached by reading our blogs.