News for hackers. Stuff that matters.
Re:Death by a Thousand Microservices by aledalgrande on Tuesday September 12, 2023 @02:14AM (#37477424)
> And then, when you start growing, that's when you break out an independently scalable part of the system into a microservice

Respectfully disagree. At this point you start refactoring your monolith into components and actually look at performance measurements via tracing.

Do not do microservices when you're growing (or ever, most of the time).

And by the love of god, don't split your data. Data is much more complex to manage than code.

Re:Death by a Thousand Microservices by Aeolun on Tuesday September 12, 2023 @02:34AM (#37477534)
> And by the love of god, don't split your data.

I think people feel that if they introduce a new data store, they won’t have to deal with the existing nearly unusable massive data store.

Of course that just exacerbates the problem.

Re:Death by a Thousand Microservices by ngc248 on Tuesday September 12, 2023 @03:15AM (#37477745)
There is a way to splitting data. The service which owns the data always does the writes and others who need reads on that data can store replicas. ofc the complication then will be in replicating data, but this will enable services to massively scale and eliminate SPOFs
Re:Death by a Thousand Microservices by code_biologist on Tuesday September 12, 2023 @04:33AM (#37478239)
The other part of this pattern you mention (replicating data) seems solved in many cases by the data warehouse patterns of the last few years. Stuff it all in Snowflake or BigQuery then readers can query as they see fit. Query engines like Trino can paper over data storage heterogeneity / breakdowns in centralization. I'm not a fan of the "lakehouse" terminology, but it is the thing.

There are downsides to coupling more loosely with data consumers, but it keeps service owners moving without wasting time vending data.

Re:Death by a Thousand Microservices by amne on Tuesday September 12, 2023 @09:07AM (#37480579)
As long as you're not replicating the data model also which means you're now replicating the business logic that go along with the data model.

An ETL approach from the start will save you a lot of headache.

Re:Death by a Thousand Microservices by theshrike79 on Tuesday September 12, 2023 @03:35AM (#37477878)
Splitting data is just a hardcore way of splitting the responsibility for the data.

You can't have 42 different classes directly poking the User-table for example. You need one clear location that has the responsibility for the data.

If you move the User-table to a different database schema, other places CANNOT touch it because they won't have access to it =)

Re:Death by a Thousand Microservices by aledalgrande on Tuesday September 12, 2023 @03:43AM (#37477933)
And then the order table will need to set user ids as a foreign key and you will have two sources of truth lol

Will be fun when you decide that you want to have organizations to be linked to orders instead of users.

All this to say, data management and having more than one source of truth complicates your world a lot. The responsibility for writing the data has to be solved at the appropriate layer: only one entity writing it.

Re:Death by a Thousand Microservices by rewmie on Tuesday September 12, 2023 @12:39PM (#37483911)
> And then the order table will need to set user ids as a foreign key and you will have two sources of truth lol

Why should your order manager service be tightly-coupled to your IAM service when the only responsibility it has is to store a single ID?

Re:Death by a Thousand Microservices by fragmede on Tuesday September 12, 2023 @12:52PM (#37484110)
> And then the order table will need to set user ids as a foreign key and you will have two sources of truth

You might be databasing wrong if that results in two sources of truth.

Re:Death by a Thousand Microservices by Copenjin on Tuesday September 12, 2023 @03:48AM (#37477959)
> And by the love of god, don't split your data.

Most data problems can be fixed on the frontend with a few relatively simple graphql queries. /s

Re:Death by a Thousand Microservices by renegade-otter on Wednesday September 13, 2023 @09:53AM (#37496773)
You are trying to get me going, aren't you?
Re:Death by a Thousand Microservices by sethammons on Tuesday September 12, 2023 @07:09AM (#37479302)
At several places, the biggest challenge to engineering velocity and the ability to innovate is that models are joined in interesting ways that prevent them from being decoupled. A user model tied to the package model preventing independent scaling of either. Every module reaching into all the tables. Joins, joins, and joins. Vast scans. The queries become inefficient and even the mighty postgres slows down at 2k rps. It is just too tempting to reach into another team's datastore. Now the two teams are in lockstep and can't alter their own datastore because others have assumptions on how it is stored and they access it directly.

At SendGrid, we had an few tables to deal with IP management. Over time, the like 5 tables were in use by 15+ services owned by different teams with competing priorities. When we finally had to scale the database, it took over three quarters of working with other teams while we supported both legacy and the new hotness.

It is hard to see early on where whole teams can sprout up and have domain ownership and to know which areas will be common/platform-like for other teams. But as soon as two services share a table, you should see a train coming at you.

Re:Death by a Thousand Microservices by dgroshev on Tuesday September 12, 2023 @10:18AM (#37481696)
There is severe hindsight bias in play here. How many tables weren't problematic despite all those joins and just chugged along scaling fine? How many startups were bogged down by unnecessary complexity or trying to keep a semblance of consistency instead of shipping features and just didn't reach the scale when performance becomes a problem?

Joins are good, actually, and normalisation should be the default. It's much easier to keep things consistent by default rather than trying to make them somewhat consistent afterwards. When something becomes a problem there is a bunch of tools (from denormalisation or materialised views to specialised datastores) to deal with that, but before that it's just premature optimisation.

Re:Death by a Thousand Microservices by rewmie on Tuesday September 12, 2023 @12:33PM (#37483820)
> Respectfully disagree. At this point you start refactoring your monolith into components and actually look at performance measurements via tracing.

No matter how hard you modularize and instrument your service, that won't give you regional deployments, which you absolutely need to have ti be able to drive down customer-facing latencies from many hundreds of milliseconds to a few tens of milliseconds.

How do you pull that off with a monolith when you have a global userbase?

Re:Death by a Thousand Microservices by rokkitmensch on Tuesday September 12, 2023 @01:35PM (#37484665)
Do the next simplest thing: shard geographically. If you really need to handle users transiting geos, that's still dramatically simpler than meegroserbusses.
Re:Death by a Thousand Microservices by aledalgrande on Tuesday September 12, 2023 @03:09PM (#37486261)
Sharding is part of how we do it.
Re:Death by a Thousand Microservices by hot_gril on Tuesday September 12, 2023 @03:57PM (#37487189)
Splitting data is nearly the entire point of microservices. If you call two things separate services despite running on the same binary and same machine, but they use separate DBs, you'll be mostly right. If you don't want to split data then don't go towards microservices, if you do then do.