This is a PSA about Spring and Ruby on Rails. Don't know what Spring is? Jump to the bottom of this article.

Why is Spring Bad in Production?

Spring is a preloader, so it loads a copy of your rails app into memory and just keeps it there until you try to launch it. This extra memory usage is unnecessary in production for two reasons: 1) you don't need to constantly reload your Rails app in production (because you're not actively developing your application on your production server), and 2) Rails servers like Phusion Passenger ship with preloaders that take care of forking and spinning up more instances of your rails app when they're needed.

If you're just learning Rails, I recommend you check out Learning Rails 5: Rails from the Outside In. Either way, scroll down to keep reading.

See other Web Design
Updated about 14 hours ago

How Can I Turn Spring Off in Production?

This part is tricky. Basically, you have to make sure that the Spring gem is never installed on your production machine. If you've already installed it, then navigate to your Rails app's directory and run bundle exec gem uninstall spring.

In your deploy script, you probably have something like this:

cd /my/rails/app
RAILS_ENV=production bundle install

As indicated in the Spring documentation, change your bundle install command to this:

cd /my/rails/app
RAILS_ENV=production bundle install --without deveopment test

How Can I Check If Spring is Gone?

This part's not hard. Fire up a terminal on your production server and run ps aux | grep spring. If the output is blank, then Spring isn't running.

What is Spring?

Spring is a preloader that loads up your Rails app and forks it into a new process whenever you start up your Rails app. This happens whenever you run rails console, a rake task, or, in Rails 5.0 and above, rails test. In development and test Spring is a great tool because it speeds up testing and rake tasks. In production, it's just a memory hog.

Photo by Clare Black