My rails 4.1 app connects to a second, non-primary server via SSH for a backend jobs. Consequently, when the rails app restarts daily, the SSH connection needs to be live/up (rather the second, non-primary server needs to live/up), otherwise the the app crashes. This is due to eager loading by default being set to true in production.rb
(config.eager_load = true
).
I'm tempted to break this dependency by disabling eager loads, but I'm not able to find much information on the performance impact. So, my questions are...
1) if eager_load
is set to false
, will that simple slow down the app's startup time, or will the app eagerly load resources the first time they are hit?
3) If eager_load
is simply turned off, to what degree will this impact the performance off the app (more subjective question)?
2) The model that performs the SSH connection are under folder app\models\legacy
. Instead of changing eager_load
to false, can that folder be excluded from eager loaded resources? If so, how? I believe I would need to edit config.autoload_paths += Dir[Rails.root.join('app', 'models', '{**/}')]
but not entirely sure.
production.rb:
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true