On Mon, 2006-05-15 at 04:52 +0200, Michael wrote:
I am noticing considerably longer first page load times on most of my
rails apps running Rails (1.1.2) off Mongrel (0.13) on linux. After the
initial request everything seems to run OK. Has anybody else noticed
this and is there anyway to compensate.
This warm-up perioud happens with just about any Rails application (and
frankly, any application in any language) since it has to load and
configure quite a bit of machinery on the first load.
This is more pronounced if you’re loading large numbers of objects with
your AR usage. Also, you should look in your production.log file to see
what kind of timings you are getting.
Basically, you are following a red-herring by saying “mongrel” is
causing slow page load. You need to look at your Rails application and
start analyzing how you’ve implemented it.
Also following the instructions for working with unicode from the rails
wiki, the number of pages served drops noticeably. Are there any sites
on how to make rails more performant?
Read about the following topics:
- Page caching
- Fragment caching
- Reverse proxy caching
- Hand writing SQL for extra speed
That will be the first start. After that you want to look at things you
can do to just not use Rails. For example, if you’re use IO.popen for
anything then you’ll want to convert that to a DRb server that doesn’t
constantly open processes.
Another thing I would need to point out is that you want to focus your
energy on measurable goals. Instead of saying, “MY GOD, THIS IS SO
SLOW!” you should try to determine a measurable target speed you need
for your application, and then do the minimal effort to reach that goal.
Basically, you have better things to do than chase some imaginary
performance need. Many times just a few simple fixes here and there
will get you a long way.
–
Zed A. Shaw
http://mongrel.rubyforge.org/