On Tue, 2006-06-20 at 20:04 +0200, Greg wrote:
Hi,
In short, RoR is brand spanking new to me, I set up Instant Rails (if
you can call copying files “setup”) and made my own simple app via
scaffold. One table, 11 cols, 100 rows. All is well, except when I view
the data, it takes 5-10 seconds to show the page, 5-10 more seconds to
get the edit page and so on. Going back to the previous page is no
faster (via previous link).
Rails has “modes” or “environments” named after what you are doing:
development, production, test. By default Rails runs in development
mode. When you do unit testing it runs in test mode. And when you
deploy your application you have to tell rails to be in production
mode.
Development mode is slower because Rails reloads all the world every
time you hit a page. Think of this as faster than compiling your whole
java/.net application, restarting your server, checking the page, edit,
repeat cycle.
To speed things up you put your application into production mode. This
is done with -e production when you use Mongrel.
I’m running InstantRails 1.3a on XP SP2, average to aging PC: P4
2.66/1GB, nothing else going on, just Firefox. I’ve heard it’s slow, but
this would be prefaced as “painfully”. So, first, is this within the
expected window of results, ie normal. Next, any magic parameter
settings (fast=true) or other guidelines? And third, how much of a
performance difference is there if one switches to the oft-mentioned
Mongrel- just broad strokes, I know it’s all in the details.
Ruby in general on Windows is slow. Simply switching operating systems
to Linux or FreeBSD (and turning off pthreads) gives you a massive
performance boost.
Mongrel is generally faster for development work since it is able to do
fast static file serving which helps when you have to hit reload a lot.
Normally though, people run Mongrel behind litespeed, lighttpd, or
apache to get the fastest file serving possible, and then a small
cluster of mongrel servers to get good ruby/rails performance.
In short, yes switching to Mongrel will speed things up. I believe
instant rails comes with an older version of Mongrel, but if you’re
going to get serious you might as well install it all from scratch so
you know how to deploy everything. It’s not too hard on windows.
You should also read up on fragment caching and page caching as two
simple ways to give your pages snap without going insane.
–
Zed A. Shaw
http://mongrel.rubyforge.org/