Test app much slower for some requests on Render than on Heroku

I’m considering moving a Rails app over from Heroku:
Rails 6.1.4.1
Ruby 2.7.4
Postgres 13

I’ve got everything working pretty well on the render side but have noticed that that some requests take much longer for the Render CPU (Starter Plus) to process than even the base Heroku Hobby dyno.

A complex request that takes about 1-2 seconds on Heroku is taking about 13-20 seconds on render. The logs show it’s almost all ActiveRecord:
Completed 200 OK in 13888ms (Views: 0.5ms | ActiveRecord: 13588.9ms | Allocations: 157653)

Yes a lot of allocations etc, it’s a very complex request. I’m just trying to figure out why the exact same request, with the same database and setup on Heroku, on a lower tier server, takes 1/10th the time to process.

Are there other setup steps I should be considering that could be affecting the ActiveRecord performance?

3 Likes

Could this be related to Postgres? Not sure what exact version render is on but on Heroku it’s 13.6. Possibly the query is slower in the older version, or the starter postgres for Render is much slower than hobby for Heroku?

Is your Rails app running on Render and in the same region as your database?

Yes, I think the issue was the starter Postgres on Render was a bit slower than the Hobby postgres on Heroku, so the complicated query took much longer. After upgrading to standard postgres they are now comparable.

2 Likes

I’m discovering this, as well. The $7/mo Starter plan on Render does not seem to comparable to the $9/mo Hobby Basic tier on Heroku. Queries are noticeably slower (and my overall page loads seems slower, too). I guess the $20/mo Render tier is comparable to the $9/mo heroku tier? I haven’t upgraded yet.

1 Like

Upgrading to the $20 “starter” plan and also optimizing the (admittedly previously very inefficient) query a little bit resolved everything for me. It definitely did go slower than heroku for that exact situation, but it was pretty easily resolved and I’m happy with the performance of the standard plan.

I also have other apps on the $7 starter plan that work perfectly fine that don’t do that type of query that seems to slow the db down to a crawl.

1 Like

Same here. 0.8s request on Heroku (hobby tier with free postgres) vs 4s request time on Render (free trial).

This is a massive dealbreaker. I have a lot of react components, each async request taking 4 seconds to update? That’s not really useable in today’s technology…