Redis 2.2 Curbs its Memory Hunger

DZone 's Guide to

Redis 2.2 Curbs its Memory Hunger

· Database Zone ·
Free Resource
While Redis 2.0 reaches RC2 status and prepares to be shipped in a few weeks, Redis creator Salvatore Sanfilippo is already deep into development on Redis 2.2.  In fact, the 2.2 version of this open source NoSQL is nearly complete from a features standpoint.  For a description of Redis, scroll down to the last paragraph.

Redis 2.0 and 2.2

Nearing the final release, Redis 2.0 contains a new AOF (Aggregate Objective Function) tool, a new testing suite, and "ridiculous speed improvements," said Sanfilippo.  Other new features in Redis 2.0 include VM optimization and Pub/Sub matching support.  In version 2.2, the focus is on increasing Redis' reliability, enhancing documentation, and reducing memory footprint.  There are several features that Sanfilippo wanted to add, such as stronger string type controls, MULTI/EXEC with CAS support, and a good clustering solution, but right now he's slowing down the process of adding new things.

Currently the Redis developers are working on facilitating DEL replication on expires in slaves and append only files.  This 2.2 feature will make it possible to perform write operations against expiring keys.  In addition to that, the developers have already made Redis 2.2 an order of magnitude less memory-hungry for aggregates.

Lowering the Memory Footprint

Sanfilippo and Peter Noordhuis together implemented some tricks for the Hash data type and reworked the top-level key->value dictionary to save memory.  Together, these changes greatly reduced the amount of memory used by Redis on several different types of datasets.  Those datasets include:

  • Many keys containing lists with an average length of 10, 100, 300, 500 elements
  • Many keys containing sets of integers with less than 1000 elements
  • Many keys containing hashes representing objects with 10, 20, 50 fields

As a result, one million keys, for example, with 500 elements list in each key costs 2GB, and one million keys with a Hash representing a user with name, surname, and 10 more random fields costs 300 MB on Redis 2.2.  There are also plans to enhance documentation and increase reliability in 2.2, but Sanfilippo hasn't mentioned any features in those areas just yet.

What is Redis?

Redis is a speedy, NoSQL key-value store with a rich API.  It's similar to memcached because values can be strings, but the dataset is not volatile.  Unlike memcached, Redis' values can also be lists, sets, hashmaps, blobs, and ordered sets.  It also allows you to append a value to the end of an item list that has already been stored for a given key.  All of its data types can be manipulated with atomic operations to push/pop elements, add/remove elements, perform server side union, intersection, difference between sets, and more.  The project's creator Salvatore Sanfilippo was hired by VMware this year, essentially putting the company's time and resources behind the open source project.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}