Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Redis vs. Memcached

DZone's Guide to

Redis vs. Memcached

In this article, we will talk about Redis (REmote DIctionary Server). Redis is an open source, in-memory, key value store. It is also referred to as a dictionary server as the key values are not only strings, but also hashes, sets, lists, and sorted sets. Read on for more details.

Free Resource

Check out the IT Market Clock report for recommendations on how to consolidate and replace legacy databases. Brought to you in partnership with MariaDB.

RedisIn this article, we will talk about Redis (REmote DIctionary Server). Redis is an open source, in-memory, key value store. It is also referred to as a dictionary server as the key values are not only strings, but also hashes, sets, lists, and sorted sets.

Redis looks similar to Memcached but there are some differences between them.          

Feature

Redis

Memcached

In Memory

X

X

Replication

X

Partitioning

X

Data Structures

X

Authentication

X

X

Pub/Sub Model

X


Data Persistence

X

Virtual Memory

X

Feature Details

In Memory: Redis stores the key values in primary memory for quick access of read writes.

Replication: Redis supports for master-slave replication. The data access can be done from the slave and the writes can be performed from the master. The replication provides scalability and availability. As any one of the slaves gets failed, the other slave provides data access.

Data Structures: Redis stores not only strings but also lists, sets, hashes and sorted sets.

Virtual memory: Redis uses RAM for in memory storage. But, during the shortage of RAM, it uses virtual memory to keep the data.

Pub/Sub Model: Redis creates Publish and Subscribe channels where the Redis clients can subscribe to any channel to consume the data and any subscribed client to a channel can publish the data.

Data Persistence: Redis persist the in-memory data to a file system on regular intervals. During the failure of Redis node, the data can be restored from Redis Data file.

Redis has a rich set of SDK support. You can find the list of client libraries here (http://redis.io/clients).

There are lots of sites with high traffic that are already using Redis. Some of them are given below.

  • Stack Overflow
  • Craigslist
  • Rackspace
  • Plugin support for Magento
  • GitHub

The growth of Redis over the years is increasing. The stats for Redis and Memcached from DB-Engines is given below. This is how DB-Engines calculates the trend.

Redis Growth

Interested in reducing database costs by moving from Oracle Enterprise to open source subscription?  Read the total cost of ownership (TCO) analysis. Brought to you in partnership with MariaDB.

Topics:
redis ,database ,memcached

Published at DZone with permission of Siva Prasad Rao Janapati, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}