In-memory vs. disk-based DB: Why do you need a larger than memory architecture?
memgraph.com
memgraph.com
In one of my old jobs we had megabytes of infrequently accessed static key-value data. If we simply loaded it into a const (i.e. a hash table), it would blow up the RAM so much, that we would need to upgrade to bigger VPSes. If we put it in database, it would make it annoying to keep these tables up to date, track changes in them.
I figured this was one of those in-between use cases, where the best solution is to have zero-RAM lookups from SSD. In my case, I wrote a little ruby library[1] that arranges data in equal cells in a file, and performs binary searches via `pread`. This was perfect for us, because we kept data in our repos, sacrificed no RAM at runtime, SSD lookups were fast enough, and we didn't have to support a more elaborate db.
Edit: oh and I think I did come across some article like the one linked in the neighbor comment. It's starting to come back.
[UPDATE] I missed a crucial part of the problem setup, which is that the data is read-only. That obviously moots my objection.
"static key-value data. ... a const (i.e. a hash table)"
Yeah, there's a build step that sorts and arranges data into "cells", making binary search possible.
Not sure about kernel/user space. I'm just calling `pread` from ruby, so only a few bytes are loaded per lookup.
Those lookups eventually made their way into the kernel's page cache.
Yes, they did.
Most databases have their main storage on disk. That is how they define the D in ACID, durable. That is not the salient point regarding what an in-memory database is.
I appreciate that your main point is with regards to memgraph internals and it was an interesting read.
Did they mean 10 thousand times? Or is the in-memory version that inefficient?
Now if you’re comparing to spinning rust, memory is definitely going to blow it away, but commodity hardware isn’t running tens or hundreds of TBs of memory. Memory to SSD comparisons seem right.
Do you mean a RAID0 of just two or four NVMe SSDs? It's absolutely ridiculous to count aggregate DRAM bandwidth across two CPU sockets and not do the same for PCIe lanes. A fair comparison is that Genoa has about twice the DRAM bandwidth as it has PCIe bandwidth, though in a fully-loaded database server some portion of the PCIe bandwidth will be used for networking rather than storage.
I think 10x is a fair rough number though, depending on your access pattern.
Single-socket Genoa would be 12 channels of DRAM (~460.8 GB/s) and 128 lanes of PCIe 5.0 (~504 GB/s), but none of the previous comments were specifically about single-socket Genoa and I wasn't going to silently switch from considering dual-socket in one sentence to single-socket in the next sentence.
> here’s a chart comparing the throughputs of typical memory, I/O and networking technologies used in servers in 2020 against those technologies in 2023
> Everything got faster, but the relative ratios also completely flipped
> memory located remotely across a network link can now be accessed with no penalty in throughput
The graphs demonstrate it very clearly: https://blog.enfabrica.net/the-next-step-in-high-performance...
It is an fun time to be working in high-scale data systems.
This should have been a revolution in DB design, IMO, but it kind of hasn't been.
Gives me great performance (especially paired with Go), and I'm able to deliver 6-10k rps for a few dollars a month.
So either way you turn it both solutions go to disk?
Simply saying you want the data to be durable isn’t that interesting or hard to achieve, there’s plenty of ways of achieving durable storage. The hard part is doing durable storage while also solving problems like query speed, and concurrency control.
And that is ignoring performance queries that don't require any guarantees.
You are thinking of a file system.
In the context of Linux/Unix/etc, the file-system is just another API for the OS - consider /dev/null or /proc - those are certainly in the file-system but they aren’t tied to persistent storage.
I didn't say they did.
consider /dev/null or /proc - those are certainly in the file-system but they aren’t tied to persistent storage.
I'm not sure what point you're trying to make here.
> > The whole point of a DB is to remember the data after power cycle. > You are thinking of a file system.
…as though you’re saying only an FS can persist data.