Here's how I got <1 min first build & near-instant change reload


#1

Many of you are finding it frustrating to work on Reaction projects due to Meteor’s build system being quite slow on big projects. I’m going to share my (hopefully temporary) way around this.

Poor software optimization (in our case, on Meteor’s build system) can most of the time be countered by ramping up hardware capabilities. It’s not supposed to be treated as a fix—but in practice, it often turns out to be true. That’s why I had the idea to try building Reaction on a huge AWS EC2 box, just to see what it would be like.

I fired up an m5.2xlarge instance, which features the following specs:

  • 8 vCPU on last-gen Intel Xeon processors
  • 16 GB RAM (8 allocated to Node alone)
  • NVMe SSD drives
  • Datacenter-level bandwidth for fetching dependencies

I wouldn’t have thought that Meteor’s build performance would vary that much, but a blank Reaction project’s first start was done in 50 seconds. Reload times when modifying a LESS file were also almost instant. Changes made to React components are a little less quick, but match the overall performance of this setup.

In order to make this a practical solution, I had to set up SSHFS, which lets you locally mount any remote directory through SSH. Doing so, my remote files appear locally and are editable using any editor (well, not WebStorm apparently, but VS Code works well).

I keep an SSH session opened to restart/reset Reaction when I need to. Once set up, it works the same as running it locally, except you log in via SSH and mount the SSHFS volume at the beginning of your day.

This might seem overkill, but it works. Now onto the financial side of it.

An m5.2xlarge instance is $0.448/hour. Switching it off when I’m not working, it sets me back around $72/month for 8 hours a day, 5 days a week (0.448 * 8 * 5 * 4). Until Reaction moves away from Meteor, or until Meteor improves its build system, this is a solution that makes sense to me.

All in all, it’s a small price to pay for added productivity. Build times truly were killing me when working on my local machine. Now I can simply do more in less time. I would say it’s well worth the investment.


#2

Nice, that looks like a viable workaround.

It kinda reminds me of how mercedes engineered their g63. (“Aerodynamics? No problem, here’s 850 Nm. of torque!”) which is cool because it works!


#3

This is way too accurate. Pretty much the same mindset, yup!


#4

If anyone wants to work with me getting the setup file right:
Docker gist Reaction