Posted on Fri 08 August 2014

Meteor + Redis = <3

In the period of time from June till mid-July 2014 we worked with Justin Santa Barbara on the experimental Redis support for Meteor.

There is no doubt that Redis has become quite popular for a wide range of tasks. Thanks to a big number of different data-structures and operators, everyone is free to use Redis in any imaginable way: from message queue to distributed lock and to main application data-store.

The last use-case, application data-store, was the most interesting to us as we can easily synchronize data between clients and servers and give the same semantics and commands as the original Redis in a JavaScript implementation for the browser. That's exactly what we did: we have built an in-memory JS implementation of Redis commands and called it MiniRedis (the same way we already have MiniMongo for MongoDB). All the server-side pub/sub logic is implemented in a separate package called Redis-Livedata.

This allows us to give users of Meteor the same API on both client and server with seamless data synchronization.

We did some work to make Redis-based structures work with other parts of Meteor so right now you can easily publish data, subscribe to it (both client-server and server-server), control access to data and write permissions, pass Redis subset of data to Blaze Views to keep the DOM representation in sync with the model.

After talking to users about their most common use-cases, we decided to focus on Strings and Maps as those are usually the things you push to the clients as the application data. For example, you would not push a huge Set to every client, instead, you would just query on the server in an RPC or on demand.

After spending 1.5 month on this project, we are super happy with the results. I have given a talk about it on Meteor Devshop July 2014 in SF and the feedback so far has been positive. Justin and I are still thinking of continuing to work on Redis integration if the community wants it.

Also checkout another Devshop talk by Justin Santa Barbara on Meteor Devshop May 2014 that presents a different approach to the integration.

Simply speaking, this work is nothing amazing but a good show-case that the integration of other data-stores shouldn't have any problems with Meteor specifically.

© Slava Kim. Built using Pelican. Theme by Giulio Fidente on github. .