I've recently been getting into Redis and find it very appealing. I'd like to see how far I can push it's limits as a database. I read the Retwis tutorial and found it very interesting. I'm wondering if there are even more resources that give examples of data modeling in Redis? Perhaps something along the lines of a cookbook?
Thanks!
EDIT
So here are some links I've found so far. I'd really like to know some more:
Within Redis, there are two different ways of persisting data to disk. One is a method called snapshotting that takes the data as it exists at one moment in time and writes it to disk. The other method is called AOF, or append—only file, and it works by copying incoming write commands to disk as they happen.
If a Redis server that only stores data in RAM is restarted, all data is lost. To prevent such data loss, there needs to be some mechanism for persisting the data to disk; Redis provides two of them: snapshotting and anappend-only file, or AOF.
Redis isn't the best fit for persistent storage as it's mainly performance focused. Redis is really more suitable for reliable in-memory storage/cacheing of current state data, particularly for allowing scalability by providing a central source for data used across multiple clients/servers.
There is a catch in what you ask for: it all depends on your data.
Fundamentally Redis is a data structure server. How you structure your data depends almost entirely on what it is and how you need to access it. The simple and common cases are fairly well covered by the links you list.
Designing for Redis in my experience is more along the lines of "how simple is my structure?". Can you model your data via hash? If so, use the hash commands in Redis. Do you need to combine sets and key-values or hashes? Then do it the same in redis. Essentially, assume you were not using a database. If you did it entirely within your programming language and in memory, how would you model your data? Odds are that is how you'd do it in Redis - or close enough to figure the rest out.
That isn't to say that specific usage patterns will not emerge. I think they are starting to. For example a common question is about web access log storage/calculation and there are common patterns coming out of those efforts. Yet there again I expect them to essentially mirror in-memory structures common to programming languages such as hashes, sets, ordered sets, lists, key-value (ie. the variable), and atomic counters. Further, most will be specific to the program being written. I suspect that is why the cookbook is still sparse (that and it is still early).
I'd suggest joining the redis list and discussing particular needs there.
Here are a two more resources that could be helpful for Redis data modeling:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With