-> Linux - Debian - Ext4 - Kernel 6.1
Other discussions
other relevant questions:
My context
I currently use a mmap file ("/user_db/db.txt") that I share among multiple threads from a single app, for read/write access.
Note: I need persistent storage for my DB.
It works well, even under chaos testing, the threads respect the locks when accessing memory regions and so on.
Now, I keep reading about huge page, to go a bit further. Especially the 1GB ones as my file spans on multiple GB already. It would be great to have it enabled for my app.
Alternative thinking
But as I read it, what I am trying to achieve is not possible and certainly the wrong way to do it (or are there solutions as of 2023?).
I should instead use DIRECT_IO (meaning reading a 512bytes block, modifying the offsets with my data, and write back to disk), but that's too much, 512 bytes is too big and will create a greater contention for my access pattern. A cache line size is fine though.
The best option that could exist for me is a transparent huge page of size 1GB (I have 32GB+ RAM systems at hand for this single app).
Any modern options I missed? Thanks