A lament for max_user_watches

July 27, 2019

This week when trying to build a client’s website on my laptop, I got a never before seen error when trying to build the project with gulp

Error: ENOSPC: System limit for number of file watchers reached

A quick search query tells you that you need more inotify watchers. If you’re on Debian/Ubuntu you can get the current number of watchers available to your system…

cat /proc/sys/fs/inotify/max_user_watches
// 8192

It’s related to a WSL2 limitation where it starts with only 8192 max_user_watches. That literally means my computer can spy on 8,192 files at a time. You would think that’s enough for a website… but apparently not in this day and age…

The advice around town is to increase your inotify.max_user_watches to 524288.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Voilà! My computer can now watch up to half-a-million files. Five hundred twenty four thousand two hundred and eighty eight files. To make a website. In 2019.

This is my lament. This is my lament about the current state of modern web development. You can convince me that npm install‘ing thousands of files is convenient and well-distributed and people are getting a lot done and boy are we making cool things and boy do we have cool tech that bundles and tree-shakes those thousands of files down to a few thousand kilobytes… but you can’t convince me it’s great.

As the American philosopher Tracy Jordan once said, “Someone put too many farts in this engine…”

For me this has battery and performance implications. My fans start screaming, my laptop gets super hot, power saver kicks on, and I have to relocate to the kitchen island to tether to myself to a socket. And this is on a $1899 laptop. God forbid I try to make a modern website on something more cost efficient.

I guess the onus is on me to come up with something better. Spoiler: My answer is going to be “Less.” That will then get met with an “Inconceivable!”. Then we’ll be engaged in a duel of wits and I know enough that you can never go against a Sicilian when death is on the line.

I doubt I’ll ever see the Promise Land on this. And why do I care so much about it. Am I even at the right moutain.