Ask HN: Need help...Rails app seems to take 300ms+ for everything.
The rather frustrating part is that most of the time is being spent in rendering views. Here are few examples.
- Completed 200 OK in 272ms (Views: 236.9ms | ActiveRecord: 15.7ms)
- Completed 200 OK in 275ms (Views: 148.2ms | ActiveRecord: 42.6ms)
- Completed 200 OK in 384ms (Views: 335.1ms | ActiveRecord: 3.5ms)
I am not doing partials in a loop etc. I am NOT querying while rendering either. Its just ruby hash operations etc which are taking up lot of ms. Now I am starting to wonder is how many SQL queries is considered normal, like in my app its around 4 - 10 queries. Is 300ms+ an acceptable response time for a Rails app which is not even launched yet (so no server load as of now). Hosted on $20 VPS Linode.
Thanks in advance for sharing your insights.
7 comments
[ 104 ms ] story [ 395 ms ] threadI am wondering if anyone can share their experiences with an y of these approaches.
Caching is something I plan to do but I wish to keep it as the last resort.
Ruby hash operations - your code or the framework?
Isolate: Eliminate as much as possible until nothing except the problem remains. You can't fix the problem until you know what the problem is, and guessing about it will just lead you astray.
Is performance still crap when you remove the db calls? When you replace the db connection with sqlite? When you remove the view logic and just render a static template? When you remove the templates altogether and just render a simple "Hello, world" string? When you put the application on a free Heroku instance instead of Linode?
Then ask yourself, does it make sense? Is Ruby so slow that a simple page takes 300 ms to load? Is a $20 (per month? per year?) Linode VPS that crappy?