When to use Redis, and how?


#1

Does anyone here have experience with using Redis and Meteor, presumably through Slava’s packages?
Any general thoughts and discussion about how and when are appreciated.

I’m putting together a real-time services marketplace and am considering using Redis (a first for me) to handle the many details like member logins & logouts, availability and real-time status, time to order fulfillment, and such. Perhaps even geolocation.

Currently thinking of these data points as a loose equivalent of app-wide Session variables.

Reasons for: performance and cost.
Reasons against: complexity and any chance of lost data.

Advice? Cautionary tales? Best practices? How have you used Redis with Meteor, and how did it go?
Did you host it yourself?
Is there any reason why I should or shouldn’t use Redis for things like instant messages/chat?

Thanks.


#2

We’ve been using Redis (outside of Meteor) in production for a couple of years now. We’re averaging around 10000 ops/s (most of which are writes) and have never seen any issues with stability. The only time we “bounce” Redis is when we update, so it normally runs for months continuously.

I am currently planning a rework of our application into Meteor and am going to use Slava’s package. I am addressing two pain points:

  1. The (currently) limited coverage of reactive support for Redis commands.
  2. The (as yet untested) issue of performance of Redis keyspace notifications.

I can work around the first relatively easily, with some minor changes to the app’s architecture. The second is more of a problem. Bear in mind that Slava recommends setting up keyspace notification for everything, which will require roughly double the ops/s in terms of publications (in our use case around 20000/s). This seems like asking for trouble, and I am considering a separate Redis micro-service just for tracking the things I’m interested in (which will still mean around 100 publications/s).

At the moment I’ve not got past a rough confirmation that “it works”. No performance or scalability tests, so I look forward to anything you discover!


#3

Thanks, we’ll see how it goes! Your comment on the keyspace notifications is a bit worrying.

I just saw that Arunoda’s / Meteorhacks’ Cluster package used Redis Pub/Sub to communicate between Meteor nodes, but he killed the project and anyway I’m not sure if it was the same as using Redis inside an app. I don’t imagine, for example that he was using Slava’s redis-livedata package…

We’ll see. I guess it’s all still quite experimental, and so not many people seem to be using Redis is their apps so far. At least there isn’t much to read about it…