Rails running costs

Care to share what your Rails running costs are like? There’s been a lot of talk about Rails not being suitable for high traffic apps (even though there are numerous examples of large scale Rails apps in the wild).

Is Rails making economic sense for you? Please share what Rails costs you to run?

TIA.

I think this question is very open ended. What are your requirements? That has a strong influence on the answer that is going to be most relative to you.

If you pair something like hatchbox.io and Digital Ocean, your costs can get extremely economic. For a site that doesn’t need a ton of memory, you could get down in the $25/month range.

On the other hand, I work on a project which has background workers running on a $500/month server from Heroku with 14GB.

$500 a month seems like a lot, but it is a lot cheaper than a devops team.

I hope this helps.

5 Likes

Thanks for your insights. US$500/mo on background workers does seem hefty. Then again, as you say, it’s not as costly as dedicated DevOps people.

I’m interested in discovering varying traffic/ cost ratios for Rails. For example, Dan at RealPython.com said in a podcast some time ago that he was spending ~US$700/ mo. on hosting a Django monolith that served 4 million users at Heroku. He also reasoned that it was acceptable vs the cost of dedicated DevOps.

On the other hand, Leaf at itch.io said in a video that he was handling millions (billions?) of requests on a US$20 VPS using Lapis.

This leads me to wonder if Rails is really only suitable for business apps with paid users.

Sorry but this question seems pretty convoluted. It’s more like you’re looking to justify digging negatively on rails.

Rails is a great framework, I run multiple sites in it and it costs me very little every month for have plenty of traffic on them. I don’t use Heroku, I do have VPS’s setup on DigitalOcean.

But if you write ineffective code, have N+1’s, have a lot of API traffic or hell just about anything to make it bog down or be heavy it can be expensive. But this can be said for any language or framework; ie PHP, Python, Go, or any other language. If you build a high volume application or something that’s inefficient and garbage it’s gonna cost you in the long run.

For what possible gain might I want to “justify digging negatively on rails”? Whatever, man :expressionless:

I’m here because I am learning Ruby and Rails and enjoy both so much that I want to use them for paid work and for my own projects. I’ve read reports that concerned me and would like those who actually use Rails in prod (like you?) to help me get to the facts sans the reactionary, snobbish accusations.

2 Likes

I found a great article by the creator of Rails Autoscale on how to select Heroku dynos for Rails.

Adding this here as I think it helps prospective Rails users with cost projections - in the absence of hard usage data.

Thanks Adam :trophy:

Our traffic average in month is around 2Gbps. the main key to reduce cost is caching strategy. RoR does not affect huge compared to other languages IMHO.

1 Like

Thank you :bulb: It seems that caching plays a major role - as does effective database design and querying. I completed Michael Hartl’s Rails tutorial and IIRC something was mentioned about pushing complex calculations down into the database as well. So, keeping intensive tasks out of the hot code paths.

1 Like

Great! what is the IIRC? and I think pushing complex calculation down into database is an old technique, because cpu in web application server is good as well as database server. web application server can be easy scaling but the database server is not.

I agree that this question can be very difficult to answer because of a lot of reasons.

  1. Are you at an idea stage, MVP stage or just checking out the options. If you’re just checking out options with a hypothetical high volume business, maybe, Rails is not great. If you’re deciding build an MVP that will be run by 100s ~ 1000s of users, Rails could give you a productivity boost. If you’re at an idea stage, i.e., pre-MVP to test the waters with 10s of users, Rails could you a low cost system to build quickly and scale up from there.

  2. Scaling to 100s of 1000s of users The question that always comes back (in my mind) is:

  • Will you make money from these 100s of 1000s of users? If yes, and let’s say 1000 of these (< 1%) will pay $10 per month, you’re getting $10k - spending even $2k per month makes sense. Rails will give you the productivity to reduce costs elsewhere
  • If you won’t be making money from them, i.e., you will pay for everything, then you have to decide: What are your other costs, and will Rails (or any tech) help you offset them
  1. How will this application hit big time?
  • If you think that it will hit big time with paying customers coming along and paying on a super-linear scale, you will have a few months before you have to worry about the performance-cost issue being a big deal.
  • If you’re making enough money, you could hire a team (or outsource) a rewrite if you can afford it. Rails might have helped with getting there quicker while your load was less and you might be able to afford a bit more infra while the rewrite is happening.
  1. No massive “internet-scale” large application runs [only] because of the stack If you’re handling business (as you say) for 10s ~ 100s of 1000s of customers with high loads,
  • You will likely need a competent team (Devs and DevOps).
  • Your application will need to be written well (and Rails + Ruby also lets you do that). There are very large applications running on Rails: GitHub, Shopify, Instacart, Basecamp and Hey to name the big few - but they have teams that look at all the problems that they face and answer them holistically while still running on Rails for the most part.
  1. Team strength If you have a team, what technologies do they know and are comfortable getting down and dirty with? This could also lead to some interesting outcomes.

Sorry for the comment on negativity - but the Rails community is used to people dunking on Rails often without much basis, and sometimes, a comment like yours gets misread.

Hope this helps.

Best Regards,

Mohit.

3 Likes

A great example of this (which has helped us a lot) is JSON generation. PostgreSQL (and Oracle, etc.) let you create JSON directly in the database. You can, of course, load an ActiveRecord collection (say, 500 records) and then do to_json on it but that means that Rails will create 500 ActiveRecord objects first and then a lot of other stuff to get to the final JSON string. If you can let your database handle it, you directly get a single string that you send on to the client to do what is needed. It doesn’t work for all use cases but does work in many. Best Regards, Mohit. 2021-12-28 | 10:58 am.

2 Likes

agree with your example. thanks for sharing. however, complex operations in terms of database are like aggregation i.e. cpu intensive job.

1 Like

I have a client that pays about $2.5k/month for dynos/background works, services, etc.

Sounds like a lot until you see they make $100k/month off the app

It’s all relative

Also, 99% of Rails apps (or any apps) will never have a million users or extreme traffic, just saying

1 Like

IIRC = if I remember correctly :slightly_smiling_face:

1 Like

With around 20k active users on an app not unlike discourse, rails + postgres + elastic search + redis + S3 for images + daily email + sidekiq costs about $400 per month.

I expect we could get that number down quite a bit by using a different host but it sure is nice not having any sysadmin tasks (or sysadmins for that matter).

1 Like

Thanks @RaggedClown. $400 does seem steep for 20k active users - but it covers all those services AND dev ops. Is this is on Heroku?

Thanks @Irish . Hard data like this helps with visualising costs. I agree - most apps won’t have to sweat traffic like that.

@onghu this is super helpful, thank you. I appreciate your point about negativity in the community.

It seems to me that a major advantage of Rails is allowing smaller teams to get stuff shipped with less hassle, and some of this credit goes to the Ruby programming language itself. I am still learning Ruby but I really enjoy it more than anything else I have worked with, including Python. I would pick Ruby work any day.

Yes, Heroku. Sending email makes up a big chunk of the cost.

1 Like

Cheers! The Ruby, Rails and JRuby communities are all very helpful and empathetic. Welcome to the team. Hope that things work out for you. I’m also glad that your question has brought out real numbers of what people are paying - and that puts things in context… better than the textual descriptions I gave. Best wishes, Mohit.

1 Like