News for hackers. Stuff that matters.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by YetAnotherNick on Thursday May 04, 2023 @03:15AM (#35812296)
Microservices works better if you don't trust other team. While having trust seem like a basic thing, this is absolutely not the case for a lot of companies.

With microservices, it is easy to see services which are down or have high error rate or latency, have clear API contract and call out the team for breaking API contract, and assign cost for which the teams have incentive to reduce, or at least not increase it.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by __turbobrew__ on Thursday May 04, 2023 @03:27AM (#35812377)
Another pain with monoliths is that they can only be deployed if the entire monolith is passing all tests. When you cannot deploy your changes because someone else on an entirely orthogonal team broke something in the monolith which is not related to you it gets old really quick.

Large monolithic repos with many independent targets for testing and deployment work the best at huge scales. If you are only a few hundred engineers, monorepo with monolithic deployments and tests work fine.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by bottlepalm on Thursday May 04, 2023 @03:57AM (#35812553)
Tests passing should be a gate to merge into main. Tests can also be run in parallel.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by kubanczyk on Thursday May 04, 2023 @04:23AM (#35812661)
Two green changes merged to a green main can produce a red main.

This is not a commonly known fact. Just to take an example of GitHub, this check is disabled by default:

> Require branches to be up to date before merging

> Whether pull requests targeting a matching branch must be tested with the latest code.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by arp242 on Thursday May 04, 2023 @04:41AM (#35812757)
> Two green changes merged to a green main can produce a red main.

I'm sure this happens occasionally, but I've never experienced it, and it seems to be rare enough that it's not that big of a concern. Especially since it'll be easily remedied by either just fixing the error or just reverting one or both of the changes.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by bottlepalm on Thursday May 04, 2023 @05:14AM (#35812950)
It's definitely an issue if you're treating main as 'good to deploy'. Also with more devs the chance of this happening is pretty good. Definitely want to enforce a branch is up to date before allowing merge (though with a lot of devs this can become difficult) not sure if there is some sort of merge/test pipeline solution out there.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by lxgr on Thursday May 04, 2023 @09:20AM (#35814833)
It completely depends on your organization's merge volume and your codebase's complexity. I've seen it happen many times working on a large monolith. But requiring a passing integration branch build before merging to master, or a merge queue, solves that.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by byroot on Thursday May 04, 2023 @05:22AM (#35812999)
> Require branches to be up to date before merging

Because this really doesn't scale well with the number of developers.

For larger teams the solution is to use a merge queue, e.g. https://shopify.engineering/successfully-merging-work-1000-d...

I haven't tried it, but GitHub is now offering such feature in public-beta: https://github.blog/changelog/2023-02-08-pull-request-merge-...

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @04:02AM (#35812573)
I'd ask why people are merging things that break the tests? I worked on a monolith with hundreds of devs and I can count the time the tests failed because someone force-merged something in an emergency on one hand. It was generally unacceptable to merge something when tests failed; you had to have a really good reason.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by anonzzzies on Thursday May 04, 2023 @05:37AM (#35813070)
Yes, this seems weird; merging breaking code is not an option. The 'breaking team' will have to wait/fix on their side, not us waiting on them for deployment of our working and tested features.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @05:50AM (#35813126)
There are some extreme circumstances where pushing broken tests to production make sense. For example, if you push a simple change to simply `return false` and disable a feature in code. In this case, the tests using it will probably fail but the desired behavior happens in production. At this point, you have a bit more time to set the tests to 'skip' while the load is shed in production. Even if you break tests on purpose, you should fix them asap as you are blocking literally every other team in the company. Thus, you need a really good reason to do so (like if you didn't do it asap, global downtime would ensue).
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by Akronymus on Thursday May 04, 2023 @06:06AM (#35813231)
Currently we have the problem of merges of two working branches occasionally resulting in a broken one. How does one solve that?
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @06:35AM (#35813408)
Don’t merge. Rebase only. Keep a linear history.

When committing, do a ff-only of ‘main’ to your branch. Yes, this forces everyone to rebase before “merging” but in practice, this results in the least amount of failures, tests being run after you resolved any conflicts, etc.

If you can use GitHub merge queues, that solves a ton of this, and you can run tests on the final merge before actually merging instead of relying on rebasing.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by whstl on Thursday May 04, 2023 @09:12AM (#35814726)
"Don’t merge. Rebase only. Keep a linear history."

This. It makes life so much simpler. With teams that don't have a lot of experience with git, however, I tend to use the "Squash and Merge" feature, coupled with forcing a linear history.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by lxgr on Thursday May 04, 2023 @09:18AM (#35814808)
Requiring a passing integration branch before merging to master. Merging the integration branch then becomes a fast-forward merge.

Alternatively, if you have a low enough merge volume, requiring mergers (by policy) to squash and rebase (and re-run tests before attempting to merge) can work too, as others have already mentioned.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by jmillikin on Thursday May 04, 2023 @06:01AM (#35813196)
1. Add a test with a time-bomb (such as a test certificate with 365-day duration), wait a year, and now your test fails without having changed.

2. Add a test with a network dependency, and when that dependency is slow / down / turned off, the test starts failing.

3. Add a dependency on a third-party Github repo that clones from `main`, and the next time some dev touches a file in that repo your test starts failing.

4. Add a test that allocates memory in proportion to size of the codebase (e.g. because it tries to build a giant in-memory tarball of all the .mp4 assets). Eventually it will get flaky when it starts scraping up against the build machine's limit. Extra fun if your builds run without defined memory limits on machines of different sizes.

In a monolithic build, there's all sorts of ways for a single person to cause other teams' tests to fail, even months or years after they've left the company. Some of them can be prevented mechanically (such as by running tests without network access), but a lot come down to "tell them to stop doing that".

That's why big companies never run one build per repo.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @06:29AM (#35813375)
Hmm. We never had those specific issues. For (1), we had time bombs for sure, but those usually highlighted coverage issues. Dev ops would disable your test and tell you to fix your code.

IRT (2), network dependencies were forbidden in-general. Over any long enough timespan, the rate of failure is 100%. If you wanted to use the network, you had to consider the failure case and handle it in your tests.

For (3), all dependencies were committed as part of the repo. All dependencies had to be reviewed for any issues before being used, so this made sense. You simply weren’t allowed to just randomly include a new dependency without a review/PR to add it.

For (4), our dev environments had less memory than build machines and the same as production. If you couldn’t build it in a dev environment, it wasn’t getting committed without special treatment from dev ops (and a really good reason).

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by jmillikin on Thursday May 04, 2023 @08:38AM (#35814321)
Yeah, all of those mitigations don't work as well when you've got thousands of engineers whose work would be blocked if some intern's badly written test blows up.

A monolithic build means that your ability to develop and deploy your team's code is dependent on every other team. As the number of teams gets larger, that multiplier really hurts.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @10:41AM (#35816118)
It's a learning experience. If everyone learns from it, it probably (most likely) won't happen again. Everyone learns how to write better tests. And, like I said, if you absolutely need to merge something right this exact second and it can't wait until someone disables the failing test (or you can't do it yourself for some reason), you can always merge it even with failing tests.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by __turbobrew__ on Thursday May 04, 2023 @12:57PM (#35818552)
Average tenure at most companies is 2/3 years. You cannot rely on people learning from mistakes because there are always new people, you need to make it so they cannot make mistakes or if they make a mistake it isn’t going to block the whole company from executing.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by withinboredom on Thursday May 04, 2023 @01:05PM (#35818693)
Organizations learn, it gets embedded in the culture, tooling, and automation. I shared some of the rules that were embedded in our organization via style guides and onboarding.

There were a thousand automated checks to prevent you from doing the same thing as someone else that caused downtime in the past. It was virtually impossible to commit code that deleted/truncated a table, for example.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by nikita2206 on Thursday May 04, 2023 @05:03AM (#35812891)
IMO for these rare occasions it should be okay to unmerge PRs. Or what could also be done is you only deploy cherry-picked releases, granted that you have a way of tracking commits in the upstream such that no commit ever gets lost.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by __turbobrew__ on Thursday May 04, 2023 @02:58PM (#35820411)
That is possible, but at that point you need a integrations/release team to babysit the builds and make sure everything integrates back together cleanly.

The last thing I want to do is have my build broken by someone on another team and then have to track them down and babysitting the revert. That is easily an hour of my time wasted.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by exitheone on Thursday May 04, 2023 @05:53AM (#35813149)
It's not only tests, a rollback because your pdf generation has a bug will also mean rolling back for example a customer facing new API, slowing down the API team until the monolith is fixed or the change reverted and rebuilt.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by citrin_ru on Thursday May 04, 2023 @06:02AM (#35813203)
1. Monolithic app and VCS mono-repo are orthogonal and can be mixed in different combinations (with different tradeoffs).

2. How about an old way of blocking deployments less: parts of this monolithic apps developed as libraries with a stable API, a new version of a library released only after its own tests has passed, next you can increment dependency version in the monolith and run integration tests, if they failing you can revert to the old library version and still go ahead with the deployment (if you don't depend on something added in the latest library release). If you depend on this new feature and a component providing it is broken micro-services would not help you.

> If you are only a few hundred engineers, monorepo with monolithic deployments and tests work fine.

And here lies a very important problem IMHO - many (if not majority) of organizations (which do at least some software development) have less than 100 software developers but the industry best practices (which include micro-service architecture) are defined by FAANG-sized organizations and at least some of these practices are sub-optimal for small shops.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by adql on Thursday May 04, 2023 @06:10AM (#35813270)
>Another pain with monoliths is that they can only be deployed if the entire monolith is passing all tests. When you cannot deploy your changes because someone else on an entirely orthogonal team broke something in the monolith which is not related to you it gets old really quick.

You can just... not allow code not passing test into master branch. They can fuck around in their own one, that's what branches are for

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by __turbobrew__ on Thursday May 04, 2023 @02:54PM (#35820362)
Tests can pass before they are merged but fail after merge. Tests can also regress over time and become flaky.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by drw85 on Thursday May 04, 2023 @10:36AM (#35816031)
Aren't you just hiding the flaws in the overall system by confiding the tests to your microservice?

That's my experience at least. Things still break, you just notice it later.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by bottlepalm on Thursday May 04, 2023 @03:55AM (#35812542)
The problem is when the company re-orgs you can easily end up with many more microservices than there are teams. Then you’re really up a creek.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by nomilk on Thursday May 04, 2023 @04:21AM (#35812651)
I haven't worked on a microservice architecture yet, but this is a very interesting idea that I hadn't heard before. That micro services can potentially give greater visibility of each team's performance, improving accountability.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by adql on Thursday May 04, 2023 @06:16AM (#35813302)
It's way too easy to just add a lot of friction if you go too far.

I also think it would be way healthier if teams acted as "maintainers" rather than "sole developer" of a service.

For example if team A wants feature from service team B manages they should be free (after communicating that so there is no confict/work duplication) to just make that feature and submit pull request to the team B.

Then team B can make sure it's up to their standard but that's shorter work than getting the whole machine of "submit a ticket for team B to add feature, find manpower to do it, and schedule work" running.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by lxgr on Thursday May 04, 2023 @09:22AM (#35814868)
It's incredibly easy to game that architecture in a low-trust environment, though. If a team owns the interface definition of their microservice, they can just declare all callers' problems an instance of "holding it wrong".
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by IshKebab on Thursday May 04, 2023 @05:14AM (#35812952)
I think the trust issue doesn't really justify microservices. Assuming everyone is using interoperable languages you can still have a monolith with clear API contacts and separate ownership by using traditional libraries.

That is a good point about reliability and cost though. I hadn't heard that before.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by YetAnotherNick on Thursday May 04, 2023 @05:25AM (#35813012)
What if some team makes the their part 10 times slower. This is not a theoretical scenario, but one I saw happening many times. While technically you could partition and monitor each part of the monolith separately, but then you are just reinventing microservice architecture.
Re:Prime Video Abandons Serverless Distributed Stack for Mon... by IshKebab on Thursday May 04, 2023 @12:34PM (#35818125)
You just run a profiler. It's better and arguably easier than microservice profiling since it doesn't only measure at the interface, can measure fine grained memory usage, etc.

Google "continuous profiling".

I'm not sure why you would think that that reinvents microservices.

Microservices is just taking a monolith and moving the components into separate processes that communicate via RPC.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by YetAnotherNick on Thursday May 04, 2023 @09:08PM (#35824163)
In my experience, profiling is hard and a lot of times doesn't show the issue. e.g. for unnamed goroutines it is hard to see which goroutine profiler is referring to. Or say if some code change increased CPU usage without increase in time/memory, it will affect the entire monolith performance. Yes a good maintainer could pinpoint the issue, but remember my premise was that it is low trust environment, and saying I think your code change increased CPU usage involves talking to managers and being in 2 meetings. And in microservice they would have to deal with their alerts to not miss the SLA.

> Microservices is just taking a monolith and moving the components into separate processes that communicate via RPC.

Microservice architecture divides the responsibility much more than that. They have separate redis cache, local cache, tests, and even likely has different DB etc.

Re:Prime Video Abandons Serverless Distributed Stack for Mon... by lxgr on Thursday May 04, 2023 @09:16AM (#35814783)
That's my experience too. Microservices are first and foremost a technology to dilute responsibility, and if you're clever about it, you can even let it fall through the cracks completely.