Assets (private directory) directly effect reload time and node memory usage

I’m sure someone will just say “of course you shouldn’t put that much stuff in your private directory”, but there doesn’t seem to be any mention/warning about it in documentation, and I did this thinking I was putting things where they belonged to keep everything tidy and organized.

This should be easily reproduced.

Take a couple few gigs of files, put them in a folder, throw that folder in your private directory.
Watch any code change, reload, HCR, etc suddenly start taking 3-5 minutes or more.
Check the memory usage of your node process. Watch it go from <1GB to a number that is oddly around the same amount as the size of the files you’ve put in your private directory.
Remove the large directory from private and enjoy quick code refreshes and life going back to normal.

Another interesting undocumented Assets issue:

Call Assets.getText() somewhere in Meteor.startup. I import some json config files, etc.
Now throw a Mac application (.app) into your private directory. Watch as suddenly your Assets.getText() calls start throwing “Unknown Asset” errors.

My guess there is that since a .app file is actually a directory with all sorts of subdirectories and files, that the time it takes to go through it on a reload causes Meteor.startup to reach the Assets.getText() calls before the json files have been reached, indexed, whatever happens to them. Renaming the .app file doesn’t help as it seems to go through subdirectories before any individual files.

So, now I know, be more careful about what I put in the private directory. Watch out for large files, many files, or deep directory structures. Again, this is probably obvious to a lot of folks, but as far as my searches found, totally undocumented.

Yeah, I noticed the same thing about private a while back.

Ahh, thanks for the link. Glad to see my observations confirmed and that there’s an issue open for it. Hopefully it will get tended to eventually.

The “Unknown Asset” errors are a lot more disturbing though. If there’s no issue open for that, you should report it.