posix_fadvise(fd, start, end, advice) allows one to specify that a file should be omitted from the filesystem cache after a read(), among other things.
I filed a libuv issue for posix_fadvise (which probably should have been titled "enable omitting pages from filesystem cache on/after read"), and someone labeled it API & Unix, and then Bert closed it without comment. I don't get it.
Reading a large collection of files once each (as for backup, indexing, synchronization) will wipe out the filesystem cache, impacting performance. I'd think that libuv needs to handle this.
Even if I made my own binding for posix_fadvise() it's not obvious how to integrate that into a createReadStream(file) object.
On Nov 27, 2:30 pm, Liam <networkimp...@gmail.com> wrote:
> posix_fadvise(fd, start, end, advice) allows one to specify that a > file should be omitted from the filesystem cache after a read(), among > other things.
On Nov 29, 11:29 pm, Liam <networkimp...@gmail.com> wrote:
> I filed a libuv issue for posix_fadvise (which probably should have > been titled "enable omitting pages from filesystem cache on/after > read"), and someone labeled it API & Unix, and then Bert closed it > without comment. I don't get it.
Wut - sorry, I didn't mean to close it (which does not mean that I am now enthusiastic about the feature.).
On Nov 30, 2:15 am, Bert Belder <bertbel...@gmail.com> wrote:
> On Nov 29, 11:29 pm, Liam <networkimp...@gmail.com> wrote:
> > I filed a libuv issue for posix_fadvise (which probably should have > > been titled "enable omitting pages from filesystem cache on/after > > read"), and someone labeled it API & Unix, and then Bert closed it > > without comment. I don't get it.
> Wut - sorry, I didn't mean to close it (which does not mean that I am > now enthusiastic about the feature.).
Thanks. I renamed the issue. Insights on how to do this in Windows?
On Nov 30, 2:31 pm, Liam <networkimp...@gmail.com> wrote:
> On Nov 30, 2:15 am, Bert Belder <bertbel...@gmail.com> wrote:
> > On Nov 29, 11:29 pm, Liam <networkimp...@gmail.com> wrote:
> > > I filed a libuv issue for posix_fadvise (which probably should have > > > been titled "enable omitting pages from filesystem cache on/after > > > read"), and someone labeled it API & Unix, and then Bert closed it > > > without comment. I don't get it.
> > Wut - sorry, I didn't mean to close it (which does not mean that I am > > now enthusiastic about the feature.).
> Thanks. I renamed the issue. Insights on how to do this in Windows?
There is no equivalent of fadvise() on windows.
A flag FILE_FLAG_NO_BUFFERING exists that is specified when opening the file, similar to O_DIRECT on linux. But it adds constraints when issuing a read call; you now have to read a multiple of 512 bytes and your buffers need to be page-aligned.
You can also specify FILE_FLAG_SEQUENTIAL_SCAN which tells windows that you want to read sequentially. It's probably closer to what you need.