Got called out on Pinafore server-side memory usage, took a look into it. TIL:

- If your npm script calls another npm script or uses wrappers like `cross-env` or `npm-run-all`, then each one takes up its own node/npm process 😬

- `yarn start` actually takes up slightly more memory than `npm start` (123kB vs 92kB for me), even though they do exactly the same thing

- both take up more memory than just running `node` directly (48.6kB for me), which is astonishing

If any Linux perf experts want to check my methods (`ps aux` and summing the RSS basically) or my numbers, I'd appreciate it. Frankly I find this a bit surprising, since I've been doing `npm start` for years, as it's the standard "run in production" script for the Node/npm ecosystem, and I've never thought twice about it.

I did a bit of research, but all I found was this blog post which says that yes, `npm start` uses more memory, but it may shrink over time:

Of course, leave it up to self-hosters to call me on my sloppy devops. I just throw Pinafore up on Zeit; I have no idea how much memory it's costing them, nor do I care 🙃

So it turns out that Mastodon uses this exact same `npm start` pattern for its streaming services. Apparently I am able to cut ~18-20kB off of these services by switching from `npm start` to calling `node` directly:

I would really like to be wrong about this, as it feels like a downright silly fix. So if anybody with more Linux perf experience than me would like to take a look at this, I'd appreciate it! #MastoAdmins


@nolan Under FreeBSD we launch stream daemon with the same command.

Thats only that npm start do ! ;)

Inscrivez-vous pour prendre part à la conversation
Stone Ar't Prod Mastodon

Instance personnelle de Gérald Niel (aka. @gegeweb). Peut-être qu'elle sera publique un jour… ou peut-être pas. J'ai pas encore décidé. Pour l'instant je teste la matrice, ou plutôt le pachyderme.

Je peux toutefois créer un compte à la demande pour les copains (envoyez la demande par mail à l'adresse indiqué dans le contact). Ou suivez ce lien, j'ai généré quelques invitations.
Sans garanti sur le bon fonctionnement du truc en revanche ! ;)

Si vous cherchez un point d'entrée (une instance) un peu plus sûr techniquement :