I''m new to rails (and ruby for that matter). I''ve noticed that rails runs slowly on my apache server with regular CGI execution. I was going to try running with mod_ruby to see if that will speed things up. I''m interested in hearing from anybody who has looked into this. If you have a particularly fast setup, I''d like to hear your opinion on what I should do. I loaded the profiler to see where all the time was spent, and this is the top of the list: % cumulative self self total time seconds seconds calls ms/call ms/call name 12.73 1.99 1.99 360 5.53 10.03 Integer#gcd 8.77 3.36 1.37 3122 0.44 1.34 Gem::Specification#copy_of 5.44 4.21 0.85 202 4.21 34.41 Kernel.require__ 4.41 4.90 0.69 9650 0.07 0.07 Fixnum#= 4.16 5.55 0.65 259 2.51 140.93 Array#each 3.97 6.17 0.62 67 9.25 9.25 File#read 3.77 6.76 0.59 5609 0.11 0.17 Kernel.== 2.88 7.21 0.45 5850 0.08 0.08 Fixnum#[] Why does it call gcd and Gem::Specification#copy_of ? Would the CVS version be any faster? Thanks, -Jeff Moss
On Sat, 27 Nov 2004 03:06:40 -0700, Jeff Moss <jeff-61uStg5MtoFWk0Htik3J/w@public.gmane.org> wrote:> I''m new to rails (and ruby for that matter). I''ve noticed that rails > runs slowly on my apache server with regular CGI execution. I was going > to try running with mod_ruby to see if that will speed things up.What you''re profiling is basically the startup/load/compilation phase of your program--which is exactly what mod_ruby and fastcgi are designed to eliminate. I think these two posts should help clear this up for you: http://tinyurl.com/4eqmk http://tinyurl.com/4x783 Of, if the links above don''t work just search for "rails fastcgi performance" (without the quotes) at http://groups.google.com. Bob Sidebotham Bob Sidebotham
Thanks Bob, I will definately try one of the two. Is there any reason to use mod_ruby over fastcgi? -Jeff Bob Sidebotham wrote:>On Sat, 27 Nov 2004 03:06:40 -0700, Jeff Moss <jeff-61uStg5MtoFWk0Htik3J/w@public.gmane.org> wrote: > > >>I''m new to rails (and ruby for that matter). I''ve noticed that rails >>runs slowly on my apache server with regular CGI execution. I was going >>to try running with mod_ruby to see if that will speed things up. >> >> > >What you''re profiling is basically the startup/load/compilation phase >of your program--which is exactly what mod_ruby and fastcgi are >designed to eliminate. I think these two posts should help clear this >up for you: > >http://tinyurl.com/4eqmk >http://tinyurl.com/4x783 > >Of, if the links above don''t work just search for "rails fastcgi >performance" (without the quotes) at http://groups.google.com. > >Bob Sidebotham > >Bob Sidebotham >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >
On Sun, 28 Nov 2004 00:09:20 -0700, Jeff Moss <jeff-61uStg5MtoFWk0Htik3J/w@public.gmane.org> wrote:> I will definately try one of the two. Is there any reason to use > mod_ruby over fastcgi?Hi Jeff, I don''t know anything about mod_ruby. Iin the past I have rejected using mod_perl because of complexity (perceived complexity, anyway) and an unwillingness to run a perl interpreter inside my webserver. These old biases may or may not still be applicable, and may not reflect the state of the world with mod_ruby. Fastcgi, on the other hand, was incredibly easy to understand and setup, and I could dedicate one or more processes for handling specific applications, each within it''s own cosy little process space. If needed, I believe the Fastcgi process can even be on another box. I don''t think there''s a significant performance advantage either way. My information is a little dated, and If I''ve said anything inaccurate, or if anything else needs elaborating, I''d appreciate correction. Thanks, Bob
According to some other info I''ve found, fastcgi is a bit faster in some peoples benchmarks, and I was unable to get ruby to work, some error with Dir.glob being a security risk. So I''ve gone with fcgi and the speed is fast. -Jeff Bob Sidebotham wrote:>On Sun, 28 Nov 2004 00:09:20 -0700, Jeff Moss <jeff-61uStg5MtoFWk0Htik3J/w@public.gmane.org> wrote: > > >>I will definately try one of the two. Is there any reason to use >>mod_ruby over fastcgi? >> >> > >Hi Jeff, > >I don''t know anything about mod_ruby. Iin the past I have rejected >using mod_perl because of complexity (perceived complexity, anyway) >and an unwillingness to run a perl interpreter inside my webserver. >These old biases may or may not still be applicable, and may not >reflect the state of the world with mod_ruby. Fastcgi, on the other >hand, was incredibly easy to understand and setup, and I could >dedicate one or more processes for handling specific applications, >each within it''s own cosy little process space. If needed, I believe >the Fastcgi process can even be on another box. I don''t think there''s >a significant performance advantage either way. > >My information is a little dated, and If I''ve said anything >inaccurate, or if anything else needs elaborating, I''d appreciate >correction. > >Thanks, >Bob > >