English 中文(简体)
为什么铁路在boot时间上卸载其所有附属设施?
原标题:Why Rails preloads all of its dependencies (gems) during boot time?

当铁路起步时,它会把其所有附属设施(地壳)上载,导致启动时间非常缓慢。 在中型大型项目中,铁路的启动时间为10-15秒,取决于机器。

虽然这不是生产问题,但它是发展的巨大痛苦。 特别是在TDD/BDD工作时。 有一些加快试验(如间谍)的解决方案,但它们提出了自己的问题。

我的问题是:为什么不要求每份法典档案中的必要依赖性,而不是在启动时装上所有材料?

手册的倒数要求是什么? 法典外线?

问题回答

铁路不是PHP。 一些资源已自动卸载,但你再次可能需要的所有资源都装上了boot/初始,因为在提出要求之前,更应该这样做,这样申请才准备就绪,无法按要求立即装满,从而减慢了第一项请求。 在最后一刻,在方法和装饰类别方面,仍有许多工作要做,将装货时间削减至mere 10-15秒<>,但如果你将5-10秒推到该装货时间之后,则只打上了第一次要求。 没有好的东西?

你在项目上增加的宝石/插图/图书馆,是你经历的许多负荷时间。 很多大面积的面积只能为你所需要的部分装上,而且能够利用这种优化。 例如,如果你有铁路项目,不需要积极记录,你可以取代:

require  rails/all 

......

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"

......在您的<代码>中,应用编号以削减装载(并避免数据库中不存在的错误)。





相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...