4 ms·
An AWS MySQL RDS that is sized to contain the entire db in memory and has the correct settings will also be defacto fully in memory and just as fast as Re
by sateesh 5y ago
An AWS MySQL RDS that is sized to contain the entire db
in memory and has the correct settings will also be
defacto fully in memory and just as fast as Redis but now
you're getting a whole relational db with all the added
benefit that entails
Are you making this assertion based on your practical experience or making a theoretical point. If it is the latter then probably it might not be correct. This is what the book Designing Data Intensive Applications from Martin Kleppman has to say:
Counterintuitively, the performance advantage of in-memory databases is not due to
the fact that they don't need to read from disk. Even a disk-based storage engine may
never need to read from disk if you have enough memory, because the operating system
caches recently used disk blocks in memory anyway. Rather, they can be faster
because they can avoid the overheads of encoding in-memory data structures in a form that can be written to disk.
(Chapter-03 Storage and Retrieval)
So it seems even the usage as you described the DB lookups won't be faster than Redis lookup. I haven't fully understood the reasoning author provides (any pointers providing more explanation are welcome). The book provides the paper https://dl.acm.org/doi/10.1145/1376616.1376713 https://dl.acm.org/doi/10.1145/1376616.1376713 (OLTP Through the Looking Glass, and What We Found There") as the basis for the above assertion.
- kitd 5y agoEven a disk-based storage engine may never need to read from disk if you have enough memory, because the operating system caches recently used disk blocks in memory anyway. OT, but this is the premise behind Kafka's log storage as well. Which is why it's great for sequential reads from the front of the log, and not as a general-purpose DB, which too many people want it to be.
- bedobi 5y agoPractical experience! Traditional db def wont be faster than Redis. (at least not in my experience) But what I'm saying is traditional db also often won't be meaningfully slower than Redis either, even for key -> value lookup where Redis shines. Overwhelmingly, when I need to store and retrieve anything, I reach for traditional dbs first by default, unless there's good reason to use some other technology. If and when load starts to become a problem, tweaking the settings, adding more read replicas etc is often enough. But if it's not, it's always perfectly possible and simple enough to add Redis on top. I feel like that gives you the most bang for your buck and the best of both worlds. But YMMV!