Live data from Hacker News

Why Segment Went Back to a Monolith

infoq.com

231–240 of 328 posts

Re: Why Segment Went Back to a Monolith

#231
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

I've found it most helpful to think in terms of deployments: Each (micro)service effectively gets deployed independently. One implication of this is you need to ensure your APIs are backwards compatible with any other services - even if it's only one service that your team also manages. This also includes databases, if shared by multiple services (which I won't get into, suffice to say congrats, your database schema…

Sharing databases across services (micro or not) is generally a pretty bad idea exactly for reasons around versioning.

Versioning APIs is a pretty standard way to get around this.

If your deployment relies on synchronized service deployments you really dont have independent services at all.

Re: Why Segment Went Back to a Monolith

#232

If you take a look at some of Segment's open source code, it isn't hard to see why they wound up struggling with microservices. It looks like they subscribe to the "left-pad" style of software development. They have tons of repositories that have less than 10 lines of code. They have a two line repository for calling preventDefault [0], a four line repository for getting the url of a page[1], and a eight line reposit…

Oh my god! Who in its right mind comes up with this? The boilerplate is 10x the size of the actual code :'(

Re: Why Segment Went Back to a Monolith

#233
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

Starting with a monolith could lead to really difficult refactorings unless you structure the code in a way that it can be easily decoupled.

Re: Why Segment Went Back to a Monolith

#234
post #233
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

Starting with a monolith could lead to really difficult refactorings unless you structure the code in a way that it can be easily decoupled.

The same argument can be made for building separate services too. Could become very difficult to merge data between two services after you had redundant information being saved across the two because of a bad design up-front.

Re: Why Segment Went Back to a Monolith

#235
post #233
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

Starting with a monolith could lead to really difficult refactorings unless you structure the code in a way that it can be easily decoupled.

I once worked in a monolith that was structured in a way that it could have been easily decoupled. It never was because the codebase was so modular and well-tested that the only time we ever felt the need was when trying to assign ownership to runtime exceptions.

https://gocardless.com/blog/getting-started-with-coach/ was the framework.

Re: Why Segment Went Back to a Monolith

#236
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

As Matt Easton says: "Context!"

I think "5 Whys" might be a useful exercise here.

Why was building X as a microservice faster? [reason]? Well, why was that?

My general rules for this are to always start in a monolith and break things out as they start to fail or break other parts of the codebase, and don't go all in just because you now have one microservice that works well by itself

I like this. A key tactic is to always do things, such that one can change one's mind!

Re: Why Segment Went Back to a Monolith

#237
post #31

Earlier quoted context omitted.

As with a lot of things, it comes down to communication. Between teams, and between the services they write. Which is just another expression of Conway's Law. IIRC Fred Brooks pointed out that the # of bugs in a system correlates closely with the # of lines of communication within and between the teams. Joshua Bloch recommends in "Effective Java" that, if possible, 3 potential clients should participate in the design…

> As with a lot of things, it comes down to communication. Between teams, and between the services they write. Which is just another expression of Conway's Law. This is so accurate. I've heard engineers give state not needing to communicate, chillingly, as a positive for microservices, like "we won't need to talk to each other if all of us are working on different services". My other favorite is using microservices a…

> not needing to communicate

sighhhhhhhhh

API documentation is a medium of communication as much as any user interface.

If you don't keep this in mind, then using your service's application programming interface will be a bad experience.

Re: Why Segment Went Back to a Monolith

#238
post #233
post #203

I see a lot of places that seem to either think that: 1. Microservices will let them ship things faster or 2. It's microservices everywhere or nothing Microservices might let you ship faster if you are really good at deciding where to draw the lines between services and really good at managing multiple deployment pipelines and all the infra - that's a pretty tough ask. Also, if you have a monolith it's perfectly fine…

Starting with a monolith could lead to really difficult refactorings unless you structure the code in a way that it can be easily decoupled.

Law of Demeter!

That idea had a lot of influence from Smalltalk, where the natural way of developing was in a monolith. So tactics like that which are about decoupling by default were a good idea in that context.

https://wiki.c2.com/?LawOfDemeter

Re: Why Segment Went Back to a Monolith

#239
post #233

Earlier quoted context omitted.

Starting with a monolith could lead to really difficult refactorings unless you structure the code in a way that it can be easily decoupled.

I once worked in a monolith that was structured in a way that it could have been easily decoupled. It never was because the codebase was so modular and well-tested that the only time we ever felt the need was when trying to assign ownership to runtime exceptions. https://gocardless.com/blog/getting-started-with-coach/ was the framework.

Exception triage often requires examining the stack regardless— even if you have multiple processes, you're still going to have errors bubbling up from your pool of shared library code.

Re: Why Segment Went Back to a Monolith

#240
post #2

How many places have gone from monolith to microservices and back to monolith? I'm sure there's been quite a few.

We did this, but on the trip back we made some major improvements.

We didnt stop at monolithic service. We stopped at monolithic repository+organization. There is now 1 VS2019 solution that covers our entire business. All of our services can be built out from this one solution via various configurations. We've even created additional solution "views" for more focused work (i.e. so you don't have to load a bunch of projects you don't care about for a specific task).

At this point, if we ran into scalability issues with a monorepo, I'd start looking for better source control/CI/CD technologies rather than splitting things up in hopes of arbitrarily keeping git viable. The benefits of having all of your source code in 1 repository with strongly-typed models throughout are impossible to overstate. When checkbuilds complete successfully in GitHub, we know the entire business is clean. Not just 1 little aspect of the product stack.

Post reply on HN