Search code examples
macoslaunchd

How scalable is launchd?


I'm contemplating implementing launchd to watch a file structure on my computer. Using watchpaths to tell whether or not one of these directories changes, though I will need to create a new property list file to account for each directory. My point of contention is as to how scalable this is; will I notice a drop in my computer's performance if im watching 10, 100, 1000 or more directories, or are the resources consumed by watching this many paths focused in memory as opposed to processing?

These jobs are going to be used to handle when a file is deleted or renamed and will update a manifest in the root of this file structure, so my application will know what files are where without walking the tree; I'm trying to make the application a little more responsive and aware. Should these jobs be daemons or agents? I've presumed agents because I don't see how this structure could be modified without a user being logged in, although these jobs would have no need to create a gui.

Will launchd be scalable enough to handle an arbitrarily sized file structure in this manner?

Are there other options? (Portability would be nice.)


Solution

  • Handling whether or not files have been renamed created or otherwise modified is better accomplished using FSEvents or kqueues.