

Ask HN: Rails App takes 800ms to respond on a VPS. Will dedicated server help? - jotto

I get very little traffic, this is purely a Rails performance problem. I am using New Relic and it's reporting the problem in ActionView. I know it's not a query issue because my queries are all properly indexed and no table has more than a couple hundred rows.<p>Even if I use some fragment caching, I'm still getting about 300-400ms delay. New Relic is reporting that ActionView is taking the most time. I also render a partial (which renders its own sub partial with AJAX forms) for each object displayed on the page (20 objects per page).<p>I'm using Passenger and Ruby 1.8.7 EE (just came out within past 2 weeks).<p>I have also tried booting up a new VPS instance to verify it wasn't the box I was on.<p>Is it worth trying a dedicated machine or will I see very little performance difference?
======
michaelbuckbee
The largest difference in performance between a VPS and a dedicated box is
Disk I/O (much better on the dedicated).

Given that, I think it's unlikely that just switching to a dedicated box would
help significantly.

A useful baseline might be to use YSlow to compare how long it takes to load
your page in Rails vs. a static version of the same.

------
carbon8
It doesn't sound like the problem is a VPS or specifically a Rails problem.
800ms is a lot, and 300-400ms for a view with fragment caching is a lot. I
have a completely unoptimized app in development with 20-item paginated lists
of partials containing partials running on a VPS (linode) that renders the
uncached view in 130ms. And this is with Haml, which is slower than erb,
especially for nested partials.

I don't know what could cause the slow-down off the top of my head. Are there
slow helpers? Also, IIRC, iterating over a collection to render each partial
is slower than using _render :partial = > @collection_.

------
st3fan
Run it on your workstation and see how fast it is. You should get comparable
speed from a dedicated server.

~~~
michaelbuckbee
Not a bad suggestion, just make sure you're running it in production locally.

