Over a million developers have joined DZone.

Redis 2.2 Curbs its Memory Hunger

· Database Zone

Build fast, scale big with MongoDB Atlas, a hosted service for the leading NoSQL database. Try it now! Brought to you in partnership with MongoDB.

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.

Now it's easier than ever to get started with MongoDB, the database that allows startups and enterprises alike to rapidly build planet-scale apps. Introducing MongoDB Atlas, the official hosted service for the database on AWS. Try it now! Brought to you in partnership with MongoDB.


The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

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

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

{{ parent.tldr }}

{{ parent.urlSource.name }}