Search code examples
ruby-on-railsruby-on-rails-3ruby-on-rails-4asset-pipeline

Rails server start up time is very slow with upgrade


I am trying to upgrade rails app from v3 to v4. In v3, the server start time is less than a minute. but in v4, it is taking more than 30 mins. In logs, i can see that for each server start,

1/10 preloading assets...
2/10 preloading assets...
.
.
10/10 preloading aseets...
done

is being logged and this is the part taking up 99% of the time. I believe assets are being compiled every time while loading the classes. could someone please let me know which config is causing this ?

I have tried most of the suggested solutions related to asset config in stackoverflow but doesnt seem to get resolved.

current config:

config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.reload_classes_only_on_change = true
config.assets.digest = false
config.assets.debug = false
config.assets.compress = false

Solution

  • Thanks for pitching in folks. Just now, got it resolved. I am using turbo-sprockets-rails-4 in which preload assets is enabled by default for dev environments.

    added below config in config/environments/development.rb

    TurboSprockets.configure do |config|
      config.preloader.enabled = false
    end
    

    now server startup time is as fast as rails3

    this is mentioned in their readme itself, but missed it while skimming through