4 ms·
What really needs to happen is that Spotlight and Time Machine need to use direct i/o (F_NOCACHE) when they read data from the filesystem, this way they won't p
by spudlyo 15y ago
What really needs to happen is that Spotlight and Time Machine need to use direct i/o (F_NOCACHE) when they read data from the filesystem, this way they won't pollute the disk cache with their reads and OSX won't swap out a bunch of pages in response.
I think you could probably hack something together that does this with DYLD_INSERT_LIBRARIES (OSX's LD_PRELOAD) that would would hook the open system call and fcntl F_NOCACHE on the file descriptor before it hands it back to the application.
- lobster_johnson 15y agoThis is the correct solution. Time Machine and Spotlight should not pollute the OS cache.
- nirvana 15y agoI bet the odds are damn good that neither of them ARE polluting the OS Cache. That they are is just speculation from someone whose taken his experience and projected it onto everybody. Since he's a person who mucks around with random system settings (like the one in his article) there's no telling what previous damage he's done to cause this problem.
- spudlyo 15y agoYou might be right. In my testing, mdworker and friends behave like you'd want them to, I don't see them polluting the cache on my Lion machine. Haven't tried time machine yet. EDIT: I can't get either spotlight or time machine to show any cache polluting behavior at all, at least not in the way that I run them. I used "mdutil -E /" to force a re-index of my disk, and I kicked off an initial time machine backup on a secondary drive I had lying around. I see both backupd and mdworker doing a lot of disk reads using iotop, but top shows my inactive memory not really changing as drastically as I'd expect, like if I were to cat a giant file to /dev/null.
- reddit_clone 15y agoThis is an excellent suggestion that might actually solve whole lot of these issues. I hope Apple engineers are looking at this thread.
- syncopate 15y agoFor Linux, there is a program called nocache, which does something similar to this: https://github.com/Feh/nocache https://github.com/Feh/nocache