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

I’m considering moving a Rails app over from Heroku:
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?

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.

1 Like