Any way to improve the speed of pnpm installs?

A similar question has come up before but had no replies.

We have a large monorepo with ~3GB in node modules.

Install time takes around 20 minutes.

I also tried on a Sprite, and that took around 60 minutes.

For comparison, I also installed on a Cloudflare machine, and the install time was about 40 seconds.

I would prefer to use Fly (or Sprites), but I would need to find a way to get these speeds to be much faster.

Has anyone had success with this or any suggestions to try?

Hi,

If you’re doing this on a Fly machine with no volumes, it’ll be slow because the rootfs is IO-limited. https://fly.io/docs/volumes/overview/

Create a volume and run any pnpm operations only in the volume. Make sure pnpm uses only the volume and doesn’t do silly things like trying to write temporary files to /tmp (it’s in the rootfs so it’ll be slow).

Also, check your machine’s metrics and if you see it’s CPU-throttling (https://fly.io/docs/machines/cpu-performance/) you’ll need a performance CPU to run pnpm installs.

Using these two tweaks I’ve seen installs of large npm projects take about 1 minute.

You could also use bun, it also results in a nice speedup but the fundamentals (writing a crapton of tiny files all over the disk) do require faster file I/O as covered above.