Tailing the prod log: 2 req/sec

can someone break down the req/sec part of the production log. I
consistently see about 60% rendering, 20%db. First question, where is
other 20%? Second question, does this mean that database performance
wouldn’t help, how would I speed up ‘rendering’?


The reason why it’s not 100% is something I also found strange.

In my experience, the database is mostly slower then the rendering (in
my application that is).
I got my rendertime down by caching what could be cached.
I got a huge list which was rendered by partials and it took quite
some time.
After caching this page, it was almost instantaneous.

Yeah - there is no caching now. Everything is dynamic down to the
obligatory time_ago_in_words…Theres a lot of avatars and stuff that
be able to be optimized.

You can cache static pages by using caches_page class method of Action
Controller. It is also possible to cache only part of the page that is
static while leaving the dynamic sections out by using fragment
caching in Rails.

When you are under situations where you cannot cache due to security
reasons you can use Action caching, this will be slower but that is
the price to pay for enforcing security. Another cool way to speed up
is to use memcached. You basically use a machine with lot of free
memory as your cache server by installing memcached. The client must
also be setup to connect to your server.

All these tricks are explained in Rails Cookbook.