I am using mmap to read a large database file (say, 100GB), for which indexes are kept in main memory (key-offset pairs).
Because of the default 4KB virtual memory page size, I assume that read calls on the file system will also use blocks of 4KB. However, that is quite inefficient for the access patterns of my application. Thus, I was investigating the possibility of using huge pages to transparently increase the size of the I/O units from 4KB to 2MB.
The typical use of huge pages seems to be to improve memory allocation and TLB utilization, but I can't find any information on how that relates to actual file I/O. With mmap
, it seems like huge pages are only supported for private anonymous maps. Is that assumption correct? I also tried looking into libhugetlbfs, but couldn't find out how I can read an actual file with it.
So, is there a way to access a file transparently using mmap
and use I/O units larger than 4KB?