You notice it when web servers are doing kernel bypass to for zero-copy, low-latency networking, or database engines throw away the kernel's page cache to implement their own file buffer.
Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
11–20 of 182 posts
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#12If you have the resources to write and maintain the bespoke method great. The large database developers probably have this. For others please don't take this link and go around claiming mmap is bad though. That gets tiresome and is misguided. Mmap is a shortcut to access large files in a non linear fashion. It's good at that too. Just not as good as a bespoke function.
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#13Old timers will recall when using mmap was a prominently promoted selling point for the “no sql” dbms.
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#14A well written bespoke function can beat a generalized function at a specific task. If you have the resources to write and maintain the bespoke method great. The large database developers probably have this. For others please don't take this link and go around claiming mmap is bad though. That gets tiresome and is misguided. Mmap is a shortcut to access large files in a non linear fashion. It's good at that too. Just…
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#15I've become convinced that there are very few, if any, reasons to MMAP a file on disk. It seems to simplify things in the common case, but in the end it adds a massive amount of unnecessary complexity.
The opposite with actual file io sucks in terms of complexity. I get that you can write bespoke code that performs better but mmap is a one liner to turn a file into an array.
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#16A well written bespoke function can beat a generalized function at a specific task. If you have the resources to write and maintain the bespoke method great. The large database developers probably have this. For others please don't take this link and go around claiming mmap is bad though. That gets tiresome and is misguided. Mmap is a shortcut to access large files in a non linear fashion. It's good at that too. Just…
This is an appeal to core database engineers to stop using the wrong tool for the job.
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#17Memory-Mapped Files = access violations when a disk read fails. If you're not prepared to handle those, don't use memory-mapped files. (Access violation exceptions are the same thing that happens when you attempt to read a null pointer) Then there's the part with writes being delayed. Be prepared to deal with blocks not necessarily updating to disk in the order they were written to, and 10 seconds after the fact. Thi…
does that get delivered as SIGSEGV to the process or something else?
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#18Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#19I've become convinced that there are very few, if any, reasons to MMAP a file on disk. It seems to simplify things in the common case, but in the end it adds a massive amount of unnecessary complexity.
From reading the paper most of the concerns are around the write side. LMDB is the primary implementation that I know which leans heavily into mmap but it also comes with a number of constraints there(single writer, read locks can lead to unbounded appending to the WAL, etc). As with any tech choice it's about knowing constraints/trade-offs and making appropriate choices for your domain.
Re: Are You Sure You Want to Use MMAP in Your Database Management System? (2022)
#20A well written bespoke function can beat a generalized function at a specific task. If you have the resources to write and maintain the bespoke method great. The large database developers probably have this. For others please don't take this link and go around claiming mmap is bad though. That gets tiresome and is misguided. Mmap is a shortcut to access large files in a non linear fashion. It's good at that too. Just…
mmap can be handy but usually is not a good idea when you care about ACID properties. So it tends to be most useful outside databases.