News for hackers. Stuff that matters.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by oopsthrowpass on Tuesday November 28, 2023 @11:07PM (#38455447)
blasphemy, this should immediately be moved to microservices and AWS and cost optimized and each component should be scaled separately (maybe some components only need 0.5 CPU, think of the cost saving t3.micro could bring and you have a highly available 3AZ potato to make sure it never goes down!!)

Then to handle any load we need to build autoscaling and spin up the toaster to medium potato and 20 instances (this costs 60k a month, but no worries we only pay for what we use so we will only run this for 27 minutes during our big sale).

Oh what wonderful world we live in and the pain we inflict on ourselves.

GJ Shopify for running a sane (tm) tech stack :)

(btw of course Rails scales it's shared nothing setup, spin up infinite app servers as long as the db can handle it. It's pretty expensive for compute though)

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by threeseed on Wednesday November 29, 2023 @12:09AM (#38455797)
a) Shopify has been deployed to the cloud since day one.

b) They run multiple app servers so each component can in fact be scaled separately.

c) They built their own PaaS which runs on Kubernetes.

d) You would have to be utterly incompetent to not care about optimising costs.

But I am glad we both agree that Shopify is doing a great job running a sane stack.

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by jduff on Thursday November 30, 2023 @07:41AM (#38472766)
Just to clarify, Shopify spent about ~10 years running on metal in multiple DCs until ~2015/2016 when it moved most of the workloads to GCP.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Tuesday November 28, 2023 @11:54PM (#38455727)
Maybe you haven't worked on a large production Rails app? Rails takes 3-4x the infrastructure hosting costs as other languages/frameworks. Not to mention the insane testing costs from Ruby test bloat.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by briantakita on Wednesday November 29, 2023 @12:21AM (#38455860)
I got burnt out on Rails after the third app in a row that I was responsible for upgrading. I appreciate Rails' contribution to web development. It took about a decade for the front end framework-library ecosystem to figure out that MPAs are more effective than SPAs for most apps. Fortunately, Astrojs is part of the ecosystem. It's sortof like the fullstack JS version of Rails/Sinatra...without the ORM which IMO adds incidental complexity.

If you have a thriving business already using Rails, it's difficult to justify moving off of Rails...now that painful upgrades seem to be mostly in the past. However, I do find isomorphic JS components & state management to be a pleasure to develop & maintain compared developing an app in two languages.

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by cultofmetatron on Wednesday November 29, 2023 @12:38AM (#38455947)
come checkout phoenix. you get a lot of the same batterries included benefits of ror but the architecture is more moduler. runtime performance is closer to go-lang and there's a really fantastic websocket and reactive frontend system built in. Erlang OTP takes it a whole other level beyond that too if you're trying to scale up.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by fredrikholm on Wednesday November 29, 2023 @02:50AM (#38456686)
> runtime performance is closer to go-lang

If you squint, yes. Erlang has had NIFs and ports since forever precisely because it isn't great at CPU intensive tasks.

In most cases however, you're still looking at an order of magnitude less servers than the equivalent Rails/Django application.

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by throwaway2990 on Wednesday November 29, 2023 @12:34AM (#38455930)
I had to upgrade a project from rails 4.2 to 5.0 and it took like 3 weeks because things just broke randomly.

Upgraded a .NET 4.7 project to .NET 6 in 3 days and haven’t touched it since. And the .NET project was larger.

I haven’t done rails since that upgrade and I hope i never have to touch it again.

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by cjblomqvist on Wednesday November 29, 2023 @01:08PM (#38462856)
Just to highlight; That's 6 major versions of .NET (so at least 7+ years in between). Including the Core era.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by pelasaco on Wednesday November 29, 2023 @01:12AM (#38456136)
If you plan the updates since the beginning, and are up-to-date with what's coming next, you are good. Having the app dualboot, running it in your CI to catch upcoming changes is a easy way to avoid such headaches
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Wednesday November 29, 2023 @09:36PM (#38468699)
This is an ironic comment on a Shopify story, they have wasted a lot of time upgrading Rails https://shopify.engineering/upgrading-shopify-to-rails-5-0
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by pelasaco on Thursday November 30, 2023 @07:21AM (#38472607)
yeah people learned with time. Github had the same problem too.https://github.blog/2018-09-28-upgrading-github-from-rails-3..... in 2023 it is so well documented, and so easy to automate, that shouldn't happen anymore.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Thursday November 30, 2023 @11:29AM (#38475468)
It's not easy to automate. As you know Github now works directly off the Rails main branch. They have both core Ruby and core Rails maintainers on staff. They have to find, fix, approve, and merge, introduced bugs every day, as well as deal with Rails bugs themselves in the main branch that emerge. This is a huge overhead cost for keeping software up to date, and does not (and should not) apply to any other company.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by pelasaco on Thursday November 30, 2023 @01:55PM (#38477478)
guess what? 99% of the apps are not github, neither shopify. You add to your pipeline some automation with https://github.com/fastruby/next_rails and you are done. I'm maintaing a rails app from 2006, with more than 1000 LC (excluding the 2k specs and views) and we are running on rails 7.1. We had one critical moment around rails 5.2 , but after that we managed to keep our stack always up to date.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Friday December 01, 2023 @05:19PM (#38493293)
Did you really mean 1,000 and 2,000 LOC for tests? Or did you mean 1000k or something else? If you meant 1,000, that is an objectively tiny app, and not relevant to the difficulty of maintaining large Rails applications.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by pelasaco on Sunday December 03, 2023 @09:32AM (#38507331)
sorry, i forgot some zeros ;)

checking again:

CODE: 198235 LOC total

SPEC: 127708 LOC total

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by byroot on Thursday November 30, 2023 @03:09PM (#38478415)
That's absolutely not a huge overhead, quite the contrary it has many benefits.

We do the same at Shopify, and running off the edge allow to catch bug much sooner and identify them much easier.

It also very significantly cuts down on maintenance cost because we no longer have to work-around bugs, we can fix them upstream and so a small update.

As for you pointing at the Rails 5 migration taking a very long time, it's true that certain major migrations were a pain this one in particular, but it's because a major API had been removed (attr_protected). We (both Shopify and GitHub) work with the edge also in part to make sure the community won't have to suffer this kind of harsh migrations ever again.

All this to say you are blowing things out of proportion. The Ruby and Rails teams at Shopify and GitHub are not an overhead, they pay for themselves, and any tech company as large as Shopify or GitHub you will find major contributors to the stack they use. e.g. There used to be a JVM team at Twitter (half smaller than Shopify even at peak).

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Friday December 01, 2023 @05:34PM (#38493485)
I'm not surprised you don't consider the team you work on as overhead. But it is just that. This is a Rails only problem. This is not a problem that applies to other engineering ecosystems, because upgrades are easy to trivial in other ecosystems. It is a problem that shouldn't exist. It makes sense that the only way Shopify has found to do efficient Rails upgrades and keep using Rails is to dedicate a team to it and subsidize Rails core development. But this isn't a model other companies should follow.

I don't see the JVM team as the same thing as a team dedicated to working off a project's core. The JVM team looks closer to the YJIT project. Making a JIT also calls into question Shopify's scalability: Rails was slow enough that they allowed a JIT to be built internally? That's quite the trade-off to make.

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by byroot on Saturday December 02, 2023 @07:30AM (#38498151)
> The JVM team looks closer to the YJIT project.

That's the same team (Rails + Ruby)...

> Making a JIT also calls into question Shopify's scalability: Rails was slow enough that they allowed a JIT to be built internally?

You are conflating scaling ability with language speed, there is of course some relation between the two, but it's mostly orthogonal.

At the scale of Shopify (several thousands developers) having a few people focus on improving Rails and Ruby is a drop in the bucket and payoff immensely.

Rails and Ruby are both Open Source projects not backed by for-profit organization. It's perfectly normal for an user of such project to contribute patches... That's how Open Source is supposed to work...

There is plenty of organizations contributing patches to the Linux Kernel (Google, IBM, etc). Using your logic that means Linux is slow enough that Google allowed a new scheduler to be built internally?

That's quite the silly line of reasoning...

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by vidarh on Friday December 08, 2023 @09:01AM (#38569115)
I have just spent weeks at $dayjob resolving Java dependency issues I wouldn't wish on my worst enemy. As much as I dislike Rails, it's nonsense that this is a Rails-specific issue.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by throw3823423 on Wednesday November 29, 2023 @01:14AM (#38456152)
I worked at a very large Ruby shop where errors in production were very expensive. This meant that we spent many times more money on instances running the test suite for every build than we spent on all production servers combined.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by iforgotpassword on Wednesday November 29, 2023 @01:58AM (#38456397)
Well the rest of the comment still holds. Rails doesn't get easier if you'd split it up into 200 Microservices.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by mathverse on Wednesday November 29, 2023 @04:07AM (#38457180)
Infrastructure is cheap. Labor is expensive.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by mlrtime on Wednesday November 29, 2023 @07:59AM (#38458785)
Infra is cheap when you're in hyper build mode. When your growth rate stalls and your expenses are greater than your income, infra gets expensive very quick and will kill your company.
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by stevebmark on Wednesday November 29, 2023 @09:34PM (#38468683)
I agree labor is expensive, which is why you shouldn't use Rails. Shopify brags it took them only a year to upgrade Rails one major version https://shopify.engineering/upgrading-shopify-to-rails-5-0
Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by nithinbekal on Saturday December 02, 2023 @08:25AM (#38498457)
That's from 6 years ago. Shopify has used Rails' main branch since 2019.

https://shopify.engineering/living-on-the-edge-of-rails

Re:Shopify Ruby on Rails distributed monolith runs 19M queri... by ksec on Wednesday November 29, 2023 @10:16AM (#38460378)
This could / was definitely true in the 201x. When most of the world's developers 's wages hasn't gone up evenly, and cost / infrastructure performance was expensive.

But we continue to see cost / performance improving. Ignoring the Rails framework and Ruby VM both together has likely gotten 2x speed improvement. We will get 96 Core Graviton v3 or 128 Core Zen 4 EPYC. Cost / Core performance is coming down and will continue to do so at least until Zen 6.

Depending on your App, somewhere along the line it will surely lean towards Ruby Rails's flavour. Assuming you do value what Rails have to offer.

I am just waiting for fibre/ async ( or something similar ) to be built into Rails and Active Record, along with even faster RubyJIT.