Earlier quoted context omitted.
A user process doesn't have the information it needs to do a good job of coordinating updates from multiple writers to database pages and indices. With MMAP, writers have access to shared atomics which they can update using compare-exchange operations to prevent data races which would be common when using read() and write() without locks.
Are you saying that without mmap() there will be data races??
Are you sure you want to use MMAP in your database management system? [pdf]
71–80 of 137 posts
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#72Choosing mmap() gets you something that works sooner than later. But then you have a pile of blocking-style synchronous code likely exploiting problematic assumptions to rewrite when you realize you want something that doesn't just work, but works well .
mmap + C++ coroutines can be combined.
Syscalls aren't free, especially today, and mmap() is already bringing significant overhead to the party.
If you've brought coroutines into the picture, you might as well schedule them using async IO completions and kick mmap() to the curb.
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#73The pragmatic consideration that usually influences the decision to use mmap() is the large discontinuity in skill and expertise required to replace it. Writing your own alternative to mmap() can be significantly superior in terms of performance and functionality, and often lends itself to a cleaner database architecture. However, this presumes a sufficiently sophisticated design for an mmap() replacement. The learni…
The original version of MongoDB used mmap, and I worked at a company that had a ton of issues with cache warmup and the cache getting trashed by competing processes. Granted this was a long time ago, but the main issue was the operating system's willingness to reallocate large swaths of memory from the address space to whatever process was asking for memory right now. Once the working set got trashed, performance wou…
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#74Choosing mmap() gets you something that works sooner than later. But then you have a pile of blocking-style synchronous code likely exploiting problematic assumptions to rewrite when you realize you want something that doesn't just work, but works well .
mmap + C++ coroutines can be combined.
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#75Earlier quoted context omitted.
You don't want the OS to take care of reading from disk and page caching/eviction. You want the DB itself to have explicit control over that, because the DB has information on access patterns and table format that the OS is not aware of. It is better equipped than the OS to anticipate what portions of tables/indices need to be cached in memory. It is better equipped to calculate when/where/what/how much to prefetch f…
I'm the author (well, one of) RavenDB You are correct to an extent, but there are a few things yo noted. * you can design your system so the access pattern that the OS is optimized for matches your needs * you can use madvise() to give some useful hints * the amount of complexity you don't have to deal with is staggering
The mmap/madvise approach works well for things like varnish cache, where you have a flat collection of similar and largely unrelated objects. It does not work well for databases where you have many different types of data, some of which are interrelated, and all want to be handled differently. If you can meet the performance needs for your product by doing what you're doing then great - that's a fantastic complexity saving for your business. But the claim that "you can design your system so the access pattern that the OS is optimized for matches your needs" is unfortunately not true. It might be good enough for what you need, but it's not optimal. That's why there's so many lines of code in other DB engines doing this the hard way.
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#76The pragmatic consideration that usually influences the decision to use mmap() is the large discontinuity in skill and expertise required to replace it. Writing your own alternative to mmap() can be significantly superior in terms of performance and functionality, and often lends itself to a cleaner database architecture. However, this presumes a sufficiently sophisticated design for an mmap() replacement. The learni…
Those could already use available high-level DBs or libraries, rather than building own.
I guess if somebody decides to building a new market-grade database system from scratch, they should hire experienced IO specialists and perhaps also lawyers, as the cache eviction algos are patented.
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#77Earlier quoted context omitted.
Yes. I hear you about the downside, but the downside of the more superficial-accessible 'home page' is that people will not read any further, and instead simply respond generically.
The current URL just redirects back to that "superficial-accessible 'home page'" anyway (probably as a substitute for 404 handling, I'd guess); if the intent is to link directly to the paper/PDF, you probably want https://db.cs.cmu.edu/papers/2022/cidr2022-p13-crotty.pdf But I agree with the other person; if people really won't read any further from the homepage, then I highly doubt they'd read any further than the h…
IMO you guys (as well as whoever did that) are underestimating the difference in how the two different kinds of submission affect resulting discussion. I did offer to change the top URL to point to the video, if they felt that was more important, but never heard back.
Re: Are you sure you want to use MMAP in your database management system? [pdf]
#78Re: Are you sure you want to use MMAP in your database management system? [pdf]
#79How do you implement lockless atomic updates for multiple writers across multiple threads & processes without mmap? With mmap it is straight forward for processes to open persistent arrays of atomics as a file, and use compare and exchange operations to prevent data races when multiple threads or processes update the same page without any file locks, advisory locks, or mutexes. With manual read() and write() calls, t…