Skip to content
mattmatt edited this page Sep 12, 2010 · 2 revisions

Why would you want Redis to store your state?

Mappers are a rather fragile part of the cluster, just like agents, especially when you run them from within your application server processes. Each mapper by default stores its own state about the agents in the cluster, watching the timeouts on them, removing them on timeout. When a new mapper comes up, it will have to wait for pings from all the agents to know about the full state of the cluster.

With Redis all that information is stored in a single place and is accessable to all mappers as soon as only one knows it. When your cluster includes several mappers it’s highly recommended to introduce Redis as state storage.

To use redis to keep the state of your nanites, add to your mappers init options:

  Nanite.start_mapper(:host => 'localhost', ...., :redis => "REDIS_HOST:REDIS_PORT")
Clone this wiki locally