This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:other-ext-apps:rails-qucik-init [2015/07/29 14:06] (current)
Michael Alegre created
Line 1: Line 1:
 +====== How to speed up Rails initialization even more ======
 +Litespeed attempts to make starting up very fast, and it does so by initializing the Rails framework in a parent process, then doing the fork. That way, all that disk-scouring to find all the rails files, which takes about 6 seconds of heavy iowait, is only done once.
 +If you want to speed things up even more you can load your controller files in the environment,​ rather than on demand. That way, they'​ll be pre-loaded for your child processes.
 +  if RAILS_ENV=='​production'​
 +  require_dependency '​application'​
 +  Dir.foreach( "#​{RAILS_ROOT}/​app/​models"​ ) {|f| $logger.d "r #{f}"; silence_warnings{require_dependency f} if f =~ /\.rb$/}
 +  Dir.foreach( "#​{RAILS_ROOT}/​app/​controllers"​ ) {|f| $logger.d "r #{f}"; silence_warnings{require_dependency f} if f =~ /\.rb$/}
 +  end
 +If you're using engines (I am), you'll want to throw in your engine directories in there too.
 +Thanks for fantasydreaming user of our forum contributing this tip.
  • Admin
  • Last modified: 2015/07/29 14:06
  • by Michael Alegre