English 中文(简体)
计算铁路应用的密集 Ruby Calc - 提取到纯Ruby & File System?
原标题:Computationally Intensive Ruby Calc for Rails App - Extract to Pure Ruby & Filesystem?

午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安 午安

我正在开发一个铁路应用程序, 通过进行一系列预估和将结果储存到数据库, 而不是在用户提出要求时进行计算, 从而大大加快这个网站的速度。

(请注意,我所说的是数十万个数据库行数以百万计的迭代。我的估计是,要完成我所能完成的所有计算,我的Macbook Air将花费大约4天时间。 )

My question is this: Would there be any benefit in stripping these calculations out of the Rails / ActiveRecord framework, and complete it all using pure ruby code and no database? Is File I/O going to be just as much of a bottleneck when writing out the results? How would you approach this issue?

谢谢!

问题回答

我认为,如果你有时间计算,你不仅应该远离铁路,而且应该远离红宝石。卢比与C或C++相比速度非常慢。所以我会使用它们,让它们储存在 db (或您铁路应用程序可以达到的其他地方) 。然后,铁路可以直接读取结果。如果这是你可行的选择,你可以考虑使用 db 程序,如果你在SQL db 上,那会比在SQL db 上的同一种标准要快得多。

当然,然后由你来决定何时触发(再)计算。 要么是基于时间的金币触发,要么是基于你系统的条件。





相关问题
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: ...

热门标签