Hacker News new | past | comments | ask | show | jobs | submit login

After almost 4 years, I recently started working on a small Rails app. Typical Rails responses used to take hundreds of milliseconds before, now it takes tens of milliseconds (with latest versions). I was not expecting that at all. Together with turbo and stimulus, responses seem almost instant. Kudos to the Ruby and Rails teams.

I am definitely excited about Ruby/Rails again!




What is a typical response? You mean an app that minimally read from the DB, or just to return any HTTP response at all? I assume the first.


Not OP, but looking at our metrics the first response I picked was a load for a blog article. It does 3 db queries (because it is not very well optimized, the blog is not super high traffic), one for the tenant, one for the actual article and finally one for the (image of the) team member who wrote the article.

This endpoint runs in ~26 milliseconds average, 6 ms of which are in ActiveRecord and 19 ms are in ActionController. I assume the remaining millisecond is an artifact of rounding in the monitoring and/or some overhead in other bits of the framework. Most other endpoints are pretty similar, though there are some internal queries for reporting etc that take much longer of course.


At the point that you have large or lots of queries on the DB or something similar, you really aren't talking about Ruby performance any more, and you'd be dealing with more or less the same problem in any language.

But in my experience, here's some data from one of our most hit routes:

Basically this route will do 5 fast DB queries (load a single record by PK), a couple of Redis lookups (one of which is returning fairly large keys).

Our mean performance is 44 ms, 95th percentile is 80 ms. Almost all of that is taken up by DB / redis, actual ruby execution is not quite a rounding error, but would not be an optimization target.

The controller itself is fairly typical - 3 or 4 before actions, a decent amount of object instantiation, some branching / logic. It doesn't involve service classes and just models.

Ruby / Rails done in a fairly "vanilla" way can be pretty performant. We've had some performance issues with our app, but Ruby itself has never been the problem.


Yes the first, minimally read from the DB and send data in response.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: