Investigating Linux phantom disk reads
I am going to write this comment with a large preface: I don&#x27;t think it is ever helpful to be an absolutist. For every best-practice&#x2F;&quot;right way&quot; to do things, there are circumstances when doing it another way makes sense. That can be a ton of reasons for that, be it technical, money&#x2F;time, etc. The best engineering teams aren&#x27;t those that just blindly follow what others say is a best practice but understand the options and make an informed choice. None of the following comment is at all commentary on questDB, as they mention in the article, <i>many</i> databases use similar tools.<p>With that said, after reading the first paragraph I immediately searched the article for &quot;mmap&quot; and had a good sense of where the rest of this was going. Put simply, it is just really hard to consider what the OS is going to do in all situations when using mmap. Based on my experience, I would guess that a <i>ton</i> of people reading this comment have hit issues that, I would argue, is due to using mmap. (Particularly looking at you prometheus).<p>All things told, this is a pretty innocuous incident of mmap causing problems, but I would encourage any aspiring DB engineers to read <a href="https:&#x2F;&#x2F;db.cs.cmu.edu&#x2F;mmap-cidr2022" rel="nofollow">https:&#x2F;&#x2F;db.cs.cmu.edu&#x2F;mmap-cidr2022</a> as it gives a great overview of the range of problems that can occur when using mmap<p>I think some would argue that mmap is &quot;fine&quot; for append only workloads (and is certainly more reasonable compared to a DB with arbitrary updates) but even here, lots of factors like metadata, scaling number of tables, etc will <i>eventually</i> bring you to hit some fundamental problems when using mmap.<p>The interesting opportunity in my mind, especially with improvements in async IO (both at FS level and in tools like rust), is to build higher level abstractions that bring the &quot;simplicity&quot; of mmap, but with more purpose-built semantics ideal for databases.