Performance (cough cough) Poor: Instant Rails

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).

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.

Any help would be most appreciated. Trying to get my business partner
excited about the whole RoR thing and slow-as-molasses is a buzz kill.

-Greg

I think your issue might be windows :wink:

I’ve got a “server” at the house which hosts 4 domains – it’s a 4yr old
AMD 1.2GHz box with 512MB ram running a rails app, along with
websites, webmail for folks and other sundries. It’s pretty acceptable.
The main limiting factor is the pipe… (no, it’s not using windows)

Although admittedly, I did try instant rails briefly. It was pretty
slow,
I thought. Easy to install, but slow.

Have you considered cygwin or another option?

Matt

Matthew W. wrote:

I think your issue might be windows :wink:

I’ve got a “server” at the house which hosts 4 domains – it’s a 4yr old
AMD 1.2GHz box with 512MB ram running a rails app, along with
websites, webmail for folks and other sundries. It’s pretty acceptable.
The main limiting factor is the pipe… (no, it’s not using windows)

Although admittedly, I did try instant rails briefly. It was pretty
slow,
I thought. Easy to install, but slow.

Have you considered cygwin or another option?

Matt

Thanks for the quick post. I’m really early into this and my RoR
experience includes passing by that funny looking guy on the book cover
at Barnes and Noble a few times, opening it once, a late night download
(last night), a quick sing-a-long with the cookbook tutorial (so easy
when someone else does all the thinking) and then zzzzzzz, both me and
my app.

Our biz is photography and this is just proof of concept stuff- anything
real will be hosted. Just trying to see if this slowpoke performance is
a result of the Instant setup, Webrick or some simple gotcha that I can
fix- are 5 sec page loads for non-concurrent access average?

On 6/20/06, Greg [email protected] wrote:

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.

Any help would be most appreciated. Trying to get my business partner
excited about the whole RoR thing and slow-as-molasses is a buzz kill.

Are you serving your Rails app with WEBrick or Apache? Are you running
in
production mode (development mode will be slow)?

Curt

Greg wrote:

slow,
(last night), a quick sing-a-long with the cookbook tutorial (so easy
when someone else does all the thinking) and then zzzzzzz, both me and
my app.

Our biz is photography and this is just proof of concept stuff- anything
real will be hosted. Just trying to see if this slowpoke performance is
a result of the Instant setup, Webrick or some simple gotcha that I can
fix- are 5 sec page loads for non-concurrent access average?

Did you use Webrick? My experience was that Webrick is quite fast…
though on Instant Rails with Apache, it did take quite a while… I got
bored while waiting for pages to reload… :-S

It was partly my fault for mot setting up FastCGI, etc…
Cheers
mohit.

Greg wrote:

slow,
(last night), a quick sing-a-long with the cookbook tutorial (so easy

If you are running in development mode then every requests reloads
everything(basically). Check how performance is with your environment
set to production. I would also suggest Mongrel over Webrick. Check
out http://mongrel.rubyforge.org/ (down for a bit right now but should
be back up soon). It works on windows and for me has been much faster
than Webrick.

Matthew M.
blog.mattmargolis.net

Greg wrote:

Matthew W. wrote:

I think your issue might be windows :wink:

I’ve got a “server” at the house which hosts 4 domains – it’s a 4yr old
AMD 1.2GHz box with 512MB ram running a rails app, along with
websites, webmail for folks and other sundries. It’s pretty acceptable.
The main limiting factor is the pipe… (no, it’s not using windows)

Although admittedly, I did try instant rails briefly. It was pretty
slow,
I thought. Easy to install, but slow.

Have you considered cygwin or another option?

Matt

Thanks for the quick post. I’m really early into this and my RoR
experience includes passing by that funny looking guy on the book cover
at Barnes and Noble a few times, opening it once, a late night download
(last night), a quick sing-a-long with the cookbook tutorial (so easy
when someone else does all the thinking) and then zzzzzzz, both me and
my app.

Our biz is photography and this is just proof of concept stuff- anything
real will be hosted. Just trying to see if this slowpoke performance is
a result of the Instant setup, Webrick or some simple gotcha that I can
fix- are 5 sec page loads for non-concurrent access average?

I tried InstantRails once back when it was first released and I don’t
remember too much about it so I can’t say if it is or isn’t the problem.
But, I can attest to the fact that webrick can be slow. Currently, on my
Windows box, I’m using RadRails (http://www.radrails.org/) and Mongrel
(http://mongrel.rubyforge.org/) for dev work. I noticed an instant speed
improvement with Mongrel and I like being able to run it as a native
Windows service (not that you can’t with webrick, I just don’t know
how).

Mongrel is also included with Instant Rails, but not yet integrated
(i.e.
you have to start up Mongrel manually). We plan to replace SCGI in
Instant
Rails with Mongrel.

Curt

If you use InstantRails out of the box, it s very slow because it s
apache + CGI so you are reloading the rails framework for each request.
If you switch to webrick you will see a big improvement and if you
switch to mongrel you will see a bigger improvement.

When I started with InstantRails I had the same problem … so I
switched to mongrel and now it works like a charm (thanks, Zed and co
!!!)

Thomas.

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/

Please do not send unsolicited mail to wku.edu email accounts. If you
feel that your message was rejected in error please contact 270-745-7000

Hey Curt, I look forward to the release.

-Conrad

We have eclipsed the 5 second barrier!!! {golf clap}

Thanks for all the posts, exactly what I was looking for/needed.
I tried SCGI, but saw no difference and was still unable to break the
barrier. Switching to prod mode turned the trick. Dev mode makes sense-
actually see your changes, what a concept. Going forward, will install
Mongrel and give it a whirl with some in house stuff. Checked out
RadRails, downloading as we speak…

And Zed, if I did all of that stuff, when would I ever take any
pictures? Our sandbox is a tiny one, any photographer site with a Flash
slideshow
is above the median, if we can add some of the RoR and Ajax
tricks/functionality to ours, we’ll be so far up the curve, we’ll have
to hold onto the railing, awash in vertigo. We’ll leave the performance,
deployment and maintenance stuff to right brainers who are actually good
at it. We’re not a high volume site or looking to package this up- we
just want a rich, rich customer experience and this platform is sooo
promising. {goosebumps}

…In any case, Mongrel is a better solution tha SCGI (you can use Mongrel with >or without Apache that’s why we are switching Instant Rails to Mongrel.

Curt

When might we see the switchover?

On 6/20/06, thomas [email protected] wrote:

If you use InstantRails out of the box, it s very slow because it s
apache + CGI so you are reloading the rails framework for each request.
If you switch to webrick you will see a big improvement and if you
switch to mongrel you will see a bigger improvement.

When I started with InstantRails I had the same problem … so I
switched to mongrel and now it works like a charm (thanks, Zed and co
!!!)

No, no, no… Instant Rails does not use CGI, it uses SCGI which
has
about the same performance as FastCGI but is way simpler.

Are you sure you weren’t running in development mode? In any case,
Mongrel
is a better solution tha SCGI (you can use Mongrel with or without
Apache)
– that’s why we are switching Instant Rails to Mongrel.

Curt

On 6/20/06, Greg [email protected] wrote:

…In any case, Mongrel is a better solution tha SCGI (you can use
Mongrel with >or without Apache that’s why we are switching Instant Rails to
Mongrel.

Curt

When might we see the switchover?

Probably sometime over this summer. There will be at least one more
release
of Instant Rails 1.x (the windows-only version) done in parallel wit the
work on Instant Rails 2 (the crosss platform version).

Curt

On 6/20/06, Greg [email protected] 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).

As a lot of people in this thread are blaming Windows, Webrick,
development mode or whatever, I thought I’d provide a counter example.

On my XP box at home i run (non-instant) Ruby on Rails with Webrick in
development mode, typically seeing response times of one sec or less.

Even if I’d stick with BSD (or perhaps Linux) for deployment, Webrick
on Windows certainly is a viable development platform for RoR.

Isak

I develop on Windows using non-instant stuff. I downloaded the 1.8.4
ruby binary and then I downloaded and installed the binaries for
Postgresql and MySql. I then downloaded the binary interface from
rails-to-postgresql.

I also downloaded and installed rails just as a gem using the ruby ‘gem’
command.

It works fine for development with webrick. It’s not fast, especially
for the very first page load. I run on a Dell Pentium M laptop running
at 1.7 gigahertz on half a gig of ram. But it’s not slow. It’s fine.
I’m sure I could develop with dozens of tables and a thousand rows.

The version of MySQL that comes with Instant Rails should be fine, so
it’s probably not the database. You can check that with a simple sql
statement. Since you probably don’t know sql, here’s how. Look in
config\database.yml to see the name of your database, call it
whatever_development, and your development password. Use the mysql
command as follows to find your table name and run the ‘select’
statement that dumps everything out. The response time should be
telling:

mysql -u root -p -D whatever_development
Enter password: *******
Welcome … blah blah blah

mysql> show tables;
±-------------------------------+
| Tables_in_whatever_development |
±-------------------------------+
| yourtablename |
| schema_info |
±-------------------------------+
2 rows in set (0.05 sec)

mysql> select * from yourtablename;
(output shows here – last line is elapsed time)

mysql> quit

Warren

It seems quite strange to me that it’s so slow. I know others have
given suggestions, and I’m sure they’ll help, but when I was running
InstantRails on Windows, it only took a second or two to load each
page. The reason I changed was because commands such as
script/generate were too slow. Now I’m using WEBrick (with Ruby/Rails
installed manually), and haven’t noticed a difference in loading
times.
-Nathan

Curt H. wrote:

No, no, no… Instant Rails does not use CGI, it uses SCGI which
has about the same performance as FastCGI but is way simpler.

Are you sure you weren’t running in development mode? In any case,
Mongrel is a better solution tha SCGI (you can use Mongrel with or
without Apache) – that’s why we are switching Instant Rails to Mongrel.
That brings up an interesting (to me, anyhow) question. Suppose I
download the latest Instant Rails and install it. This gives me a recent
Ruby and Rails, Apache and MySQL. I think PHP is also there but I’m not
sure. How do I go about maintaining the “platform”? Suppose, for
example, I want to switch from MySQL to PostgreSQL or SQL Server or
SQLite? How do I upgrade Apache or MySQL? Ruby? Rails? How do I add
non-Rails applications or even non-Ruby applications?

What brought all this on is that Instant Rails looks a lot like another
“one-click web platform” package I have on my Windows system. It’s based
on EasyPHP and implements the Moodle course management system
(http://moodle.org). I’d like to have one platform, not two.
Obviously, the application maintenance will be different, but I’d like
to be able to standardize the platform components – Ruby and PHP
interpreters, web servers and databases.

Of course, I could always switch to .NET …

> > Curt > > ------------------------------------------------------------------------ > > _______________________________________________ > Rails mailing list > [email protected] > http://lists.rubyonrails.org/mailman/listinfo/rails >


M. Edward (Ed) Borasky