Rails 3 app server startup time is long

前端 未结 3 696
遇见更好的自我
遇见更好的自我 2021-02-04 04:08

UPDATE 2 This is a known bug/feature with the way Ruby 1.9.2 loads files. http://twitter.com/#!/rails/status/72801149769621504

update:

相关标签:
3条回答
  • 2021-02-04 04:32

    Bundler often spends more than half of its time requiring gems. Are any of the dependencies that you are loading unnecessary in dev/test mode? For instance, some of my gems are only used by resque workers or in other scripts. You can add :require => false and then manually require them when you need them for some modest startup speed gains in dev/test mode.

    Before doing so, I usually profile the require statements (in lib/bundler/runtime.rb) to see if they're actually worth taking out.

    0 讨论(0)
  • 2021-02-04 04:39

    Since this is a fairly old question: Have you tested it with the release version of Rails 3?

    That is a long time but ultimately meaningless. My rails apps stay up for months at a time so that is a fraction of a fraction of 1 percent of the total runtime.

    Do you have a ton of dependencies that Bundler has to deal with? I can get my Rails 3 app started in less than 2 seconds in any environment, but I use very few third party gems.

    0 讨论(0)
  • 2021-02-04 04:46

    I have 3 rails 3 apps and i am migrating one from 2.3.8, the one on rails 2.3.8 loads in 4 seconds, and the branch that is halfway in rails 3 takes 12 seconds, all the other rails 3 projects take from 20 to 30 seconds to load, it is very depressing when i see a screencast where someone loads his rails app in 3 seconds, i have been pulling my hair ever since i migrated to rails 3 thinking it was my environment.

    0 讨论(0)
提交回复
热议问题