Redis Explained

Good article on Redis. The part that describes their use of copy-on-write is especially interesting. Copy-on-write leverages computer architecture (MMU, pages) to share memory between two users until it is written, then a copy is made. Discourse uses Redis in their stack – may explain why this site feels so snappy.

cc @bminer

The Redis source code is pretty neat.

The most important thing to note about Redis is its use of RAM-optimized data structures. Most databases use disk-optimized data structures and sometimes cache chunks of them in main memory. And of course, the latency differences between RAM and disk (even SSDs) vary by orders of magnitude.

Sadly, the common use of Redis as a caching component is fraught with complexity and esoteric edge cases. It would be better if Redis could be used as the caching layer and the main data store. That way, the complex data synchronization problem could be hidden from the end user. Ultimately, I think that a solution that provides benefits of Redis and a standard RDBMS will emerge.

1 Like

Ben Johnson comments that sqlite is fast enough that if its on the same machine, you often don’t need a cache. Working on SQLite support in SIOT now, so guess I’ll see if I can eliminate the current cache …

I have been exploring about data oriented programming lately and one of many aspects of optimizing with data in mind is about knowing your data layout and storage speed hierarchies and how data flows from CPU to storage. Perhaps this is in place in redis which is why it is so performant.

1 Like

I’d highly recommend the book by Dr. Martin Kleppmann.

Thanks @bminer, I will get a copy right away, I know @cbrake has spoken highly of this book too.