more rails optimization thoughts

beyond the discussion of “tuxedo” style rails scaling:

http://www.igvita.com/2010/06/07/rails-performance-needs-an-overhaul/

I wonder if you could do some “lazy loading” for things, like

def before_filter_method
@order = LazyLoad { Order.find(session[:session_id]) }
end

maybe that would speed things up?

In reality though, when I looked at it last it was a question of inefficient rails. At least I think so. Though maybe it’s a question of GC.
Also somebody once said their app was slower when run in multi thread with a DB pool of size > 1, i.e. single thread was faster. Huh?

So it’s probably a question of optimizing rails. Then when rails is fast, you can optimize the next thing. Is it GC? DB pools? Contention on the sessions (share memory to overcome that)? Too much of something? Having to reconstruct classes constantly?

Then optimize that thing. Or maybe it is the DB.

The performance tests against it should be multiple concurrency against multiple processes, really. But more concurrency than the processes, where possible. Would fibers help? Jruby?
This would be an interesting study.

rails woe

C:/Ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.8/lib/rails_generator/options.rb:32:in `default_options’: undefined method `write_inheritable_attribute’ for Rails::Generator::Base:Class (NoMethodError)

meant “gem_prelude is loading things in the wrong order–run it like
$ export RUBYOPT=–disable-gems
$ rails
” and it will get the right versions then.

Or uninstall all your rails 3 gem versions.

ruby woe

Open3.popen3 ‘ls’
NotImplementedError: fork() function is unimplemented on this machine

meant “you need to use 1.9 for this to work in ruby, or an external lib http://stackoverflow.com/questions/122115/what-is-the-popen-equivalent-to-read-and-write-to-a-child-process-in-windows

rspec woe

Been a little quiet haven’t I?

spec.faster_rubygems.rb:5:in `require’: no such file to load — spec (LoadError)
from spec.faster_rubygems.rb:5:in `

meant “you need a
require ‘rspec’
in your file at the top somewhere”