For the last number of years every Rails project I have worked on has the following setup:
- developers on mac and linux
- so we standardize on a Docker setup
- but it’s slow on Mac, so some people use Docker for the service dependencies not the Rails part
- as an attempt at mitigating the slowness in Docker either NFS with aggressive caching, or something like the docker volume cache mount options are used Performance tuning for volume mounts (shared filesystems) | Docker Documentation
In that set-up Spring causes one of a few problems:
- doesn’t load or reload changes promptly (or at all)
- consumes so much CPU as to significantly shorten battery life.
Some workarounds are possible, globally disable Spring and suffer (usually) some issues that actually your auto-loading doesn’t actually work in day-to-day without Spring. Using an fsevents gem to cut down the amount of polling the listen gem is doing (doesn’t work for for Docker on any platform except Linux)
So, maybe this is an autoloading+spring+docker+network filesystem issue exacerbated by teams using different OSs, but this is a common set-up in most all dev teams I’ve worked in.
My biggest gripe is that Spring hides errors all the time, it’s entirely possible to have passing local tests, and push to CI and have them fail (something worked differently with autoloading), or to lose hours in a day to wondering why changes aren’t showing, or diagnosing load ordering issues.
(Note: my most relevant experience is on Rails <6, I believe a lot of this improved a lot with Zeitwerk, but non the less Spring and the loading/setup issues (autoloading aside) is a constant headache.