3 ms·
When Andy rages about databases using mmap, he means using it to replace the buffer pool. In theory, it provides exactly what the database needs by paging the d
by sakras 4y ago
When Andy rages about databases using mmap, he means using it to replace the buffer pool. In theory, it provides exactly what the database needs by paging the data in and out on demand. In practice this scales poorly to large number of threads due to TLB shootdowns, and as Nikita said, you give up control of memory usage (since it’s the OS managing it).
Nobody is arguing that you shouldn’t call mmap to get yourself a few anonymous virtual pages to do your work in.
- menaerus 4y agoI am probably missing something but I still don't see the difference given that buffer pool will otherwise be implemented in terms of malloc, and malloc is still implemented in terms of mmap so we're back to square one. However, I could imagine that it is possible for contention in kernel-space mmap locks could be artificially relieved because of the user-space locks in malloc. Currently I don't see how TLB shootdowns would be specific to mmap only but not to malloc but I may find some time to read the paper.
- sakras 4y agoWhat we’re talking about is mmap-ing files vs doing some anonymous mapping and manually reading files. Anonymous mappings don’t incur all the TLB shootdowns that mmap’d files do.