Redis in Action with Cloud Foundry

June 12, 2012 Cloud Foundry

featured-cf-genericRedis is a popular open source, advanced key-value store project sponsored by VMware. It has been a Cloud Foundry core service from day one and is widely adopted by developers who love its performance and flexibility. In the following guest post we introduce Dr. Josiah L. Carlson who discusses his upcoming book Redis in Action and describes how Redis is continuing to change the lives of developers.

Guest blog by Dr. Josiah L. Carlson, a well-known contributor on the Redis mailing list

Over the last several years, a wide variety of non-relational databases have been created to offer varying balances of performance, reliability, and non-relational data models. In late March of 2009, Redis arrived in the open source world and has since been adopted by developers at an increasing rate, driven by a combination of performance, flexibility and a data model that programmers are already familiar with: standard data structures.

To support the growing need for operational simplicity, VMware introduced Cloud Foundry as a way to reduce the effort and overhead required to install and configure a carefully chosen variety of services, languages and frameworks. Not surprisingly (at least to those of us in the community), Redis made the cut at launch, and Cloud Foundry has made a previously easy setup procedure even easier. Assuming you already have the open source vmc tools installed and already have an app set up and configured, installing Redis for use in Cloud Foundry is as easy as:

$ vmc create-service redis --bind <app>

Once you have Redis installed, using it from one of the supported Cloud Foundry languages is only slightly different than if you were hosting your own infrastructure, primarily due to configuration. There are a few articles that discuss the configuration and use of Redis with Cloud Foundry with Ruby, Java/Spring, and Node.js.

Why Redis?

Whenever I talk to an engineer who isn’t familiar with Redis, the first question I am asked is “why Redis?” On the one hand, the answer is very simple: It makes our jobs as engineers easier by addressing problems we need to solve better, in many cases, than relational databases, document databases, or plain key-value databases. By combining five different and familiar data structures stored 100 percent in memory (but also written to disk in one of two ways), Redis offers performance and data access features that are top-notch. An increasing number of engineers, myself included, owe their success in no small part to the use of Redis as a production service.

My history with Redis

I got my start using Redis from a friend and manager who assigned a bug tracker ticket to me, mentioning that I might want to take a look at Redis to handle an internal search over some client data. Nothing too extraordinary, and it was something that Lucene could easily handle out of the box. But there was something about Redis that caught my attention. Because it was only my second task since joining the company, it was reasonable to take a little time to explore a new technology. Around two weeks later, we deployed a new internal search engine that was built using Redis hashes to store sortable data and Redis sets to store search terms. A series of set intersections followed by a sort call actually executed the search, which filtered and sorted over some 60,000 records in 50 milliseconds, or around 200 times faster than what our previous system managed. (I have previously written about a more web-page specific type of search on my blog.)

After arriving at such easy and quick success developing and deploying applications with Redis, I joined the mailing list with a few feature requests. Ultimately, only one of my requested features made it in, but in the Redis community I found a wide variety of problems posted by other developers, and I couldn’t resist offering advice on possible solutions. The breadth of problems posted to the list, along with my own experiences developing over a dozen Redis-backed tools and systems for my now past and current employers, combine to fill the pages of Redis in Action with real problems and their solutions. These are solutions that you can use today on a variety of problems with some of the most popular programming languages.

While Redis in Action is not yet complete, you can find four chapters available today through Manning’s Early Access Program, with at least one additional chapter to be released in June, and one to two chapters every month until it is done. Python source code is included in the book but translations to Ruby, Java and Node.js will be available before the printed edition is available.

Use the code 12ria39 for a 39 percent discount when you pre-order Redis in Action at:

Dr. Josiah L. Carlson is well known as an active and helpful contributor on the Redis mailing list. He has given talks about real-world uses of Redis, including building a self-service ad network, prioritizing task queues, web spiders, a Twitter analytics platform, real-time search engines and more.

The Cloud Foundry Team
Don’t have a Cloud Foundry account yet? Sign up for free today

About the Author


More Content by Cloud Foundry
git config rerere.enabled true
git config rerere.enabled true

There have been times where I performed a rebase and had to resolve conflicts as part of the rebase, and th...

Leftronic – not just a pretty face
Leftronic – not just a pretty face

Leftronic has produced a really nice clean dashboard to view all your company's data in one place. Real-ti...

Enter curious. Exit smarter.

Register Now