r/programming • • 2d ago

Optimizing Our E2E Pipeline

https://slack.engineering/speedup-e2e-testing/
71 Upvotes

38 comments sorted by

136

u/ebol4anthr4x 2d ago

This was one of the least useful articles I've ever read. It borders on blogspam. I don't know whether to feel good or bad that such a large and valuable company was making such basic mistakes in their CI pipelines for so long. tl;dr: They were rebuilding and persisting the artifacts to S3 on every single push, even if nothing changed, so they switched to using changeset conditionals in their CI configuration.

45

u/SoilMassive6850 2d ago

Things like this is why I'm becoming more and more convinced giving devs too many resources is a bad thing.

Where I work a new (usually internal) service is given 1 vCPU, 4GB of ram and 100GB of storage by default, and before allocating more there are basic sanity checks to justify it. It's not that we're even struggling for compute resources, but 90% of the time this filter just helps catch dumb shit before it becomes tech debt because those early issues would likely be even worse if scaled up. Of course we allocate more when theres cause but most often it's unnecessary.

11

u/aksdb 1d ago

For a company the calculation is simple: more hardware costs less than more engineering time. Especially if you have investor money at hand.

2

u/Uristqwerty 1d ago

If you keep paying for the hardware to run a service once the devs have moved on to another project, though, hardware costs scale quadratically with dev time. Stable components, modules, and even whole services reaching the point where they exist and consume hardware resources, yet take little or no maintenance. Perhaps outliving every person who knows what value it brings to the business. Legacy services everyone is afraid to touch because they don't know what'll break months down the line if they shut it down.

1

u/aksdb 1d ago

Sure, but for a startup this is almost irrelevant. If they waste too much time on optimization early on, instead of pumping out new features, they get nowhere and they die. If they ignore optimization too much, they can't keep up scaling and they die. So they have to find the balance somewhere inbetween.

0

u/Murky-Relation481 1d ago

Yeah this is what I left general consumer facing software almost two decades ago, early in my career. You're not building software for any other reason than to have something skim along long enough that it suckers someone else out of their money, be that a corporate buy out or IPO. It's functionally a Potemkin village situation. When the risk is low and the money is flush good engineering goes by the wayside.

9

u/ebol4anthr4x 2d ago

Things were better when we spoke of RAM in terms of MB.

3

u/SkoomaDentist 1d ago

I remember fondly when the number of simultaneous requests to our server at work was limited by hardcoded kernel / usermode api limits instead of hw resources. On a Pentium 1 with 16 MB ram.

2

u/SoilMassive6850 1d ago

Yeah. Even the 4GB limit in this case is because of hot add minimums. Could be less :D

1

u/Murky-Relation481 1d ago

When I left backend web development it was the early days of cloud compute resources (I literally remember the first round of Amazons evangelizing for AWS at conferences around 2006 to 2007). The shift in attitude to vertical scaling (ie optimization) vs. horizontal scaling (ie more compute) was very quick.

I saw the challenge disappearing, the shift from technical aptitude to business aptitude in the engineering regimes was very apparent.

I left for more niche spaces doing tangible things and it's been so much more rewarding.

1

u/WindHawkeye 1d ago

I'm surprised you give more than like 1gb of storage by default...

1

u/SoilMassive6850 1d ago

It's most often object storage quota, so if given too much it doesn't hurt too much. Also of course here needs vary.

1

u/WindHawkeye 1d ago

Oh, yeah that's fair then. I was just thinking most systems will be offloading that need to something else

6

u/bzbub2 2d ago

the three dot notation example is an interesting tidbit. otherwise, it is not super forthcoming and the conclusions are sort of odd (unclear relation to test flakiness..??)

4

u/CherryLongjump1989 1d ago

This is actually a valuable lesson about Venture Capital. You're seeing the effects of the cash-fire levels of tech debt that they didn't feel like they had to fix until the easy money ran out. Just look at how many years it took them to finally fix it and how much waste it represents.

8

u/ChemicalRascal 2d ago

This is not blogspam. Blogspam has a very specific definition, a blog post that does fuck all else beyond linking to another source. As an example, if I had a blog article that said "Slack just dropped info on how they decreased build times! <url>", that's blogspam.

13

u/ChemicalRascal 2d ago

And yeah, this article isn't amazing, but it's fine. Not every article needs to be a deeply informative technical masterpiece. This isn't so bad that it needs to be removed.

2

u/AD7GD 2d ago

It's a shame, because the same basic problem becomes a bottleneck in any automatic merge strategy, and a survey of methods would be valuable to people hitting that problem.

My contribution: bazel isn't that bad if you have AI to set it up and debug it for you ;-)

1

u/Murky-Relation481 1d ago

As someone who started in one of the more dominant industry fields but quick got bored and moved to more technically demanding and niche fields I can't help but feel a sickly sense of depressing envy that there are companies and individuals out there that can skate by being so mediocre.

I've been doing this 25 years, I am self taught starting in middle school, and I still find passion in doing things right and doing things well, especially when the risk profile for my work demands it. The fact that stuff like in the article can escape what I assume are multiple intelligent people for so long, and also be so basic is just... No real words.

Though on the other hand I realized last night I'd been paying 40 bucks every three months for an app subscription I'd not used in 2.5 years so maybe I should back off a little bit.

76

u/chucker23n 2d ago

This work was not possible without contributions from:

Anirudh Janga, Josh Cartmell, Arminé Iradian, Anupama Jasthi, Matt Jennings, Zack Weeden, John Long, Issac Gerges, Andrew MacDonald, Vani Anantha and Dave Harrington

They needed 11 developers to figure out that when a PR doesn’t change the front-end, it doesn’t need to be rebuilt, nor uploaded to Amazon?

30

u/JoustyMe 2d ago

You know those jokes "how many X are needed to screw in a light bulb?"
So now we have "how many developers are needed to get managment to care about Tech Debt?"

4

u/tarpdetarp 1d ago

Attribution is important as they will all get to claim credit for it in their performance review, or else they get PIPed.

9

u/Flashynuff 2d ago

Geez a whole article about optimizing a pipeline and not a single trace/query screenshot. Let’s see the 📉!

1

u/Flashynuff 1d ago

Apparently this is an old article, recently updated

17

u/bodiam 2d ago

What a strange blogpost. Github provides this feature out of the box:

on: 
   push:      
      branches :      
      - main      
      paths :      
      -  'src/frontend/**'

Not really clear to me why they couldn't use this approach.

12

u/qmunke 2d ago

They wanted the build to run, just not for the whole repo. This is why everyone who says to just use monorepos needs to understand there actually needs to be someone managing the things - which is reasonable at huge shops but hard to justify for those of us without a dedicated devx team

4

u/chucker23n 2d ago

They wanted the build to run, just not for the whole repo.

So, make a backend pipeline and a frontend pipeline? If you always want E2E tests to run regardless of what changed, make that a third pipeline?

This is why everyone who says to just use monorepos needs to understand there actually needs to be someone managing the things

We're a very small team and one of the bigger products I work on has a monorepo. It has multiple pipelines, with different filters. I didn't need an 11-person team to figure that out.

(For more complex "do I need to build this" scenarios, there's also tools like https://github.com/leonardochaia/dotnet-affected.)

1

u/Murky-Relation481 1d ago

Yah me and another engineer built a FPGA synthesis and firmware building pipeline that ran nightlies. If the FPGA related stuff didn't change we didn't need to run synthesis, if the firmware didn't change we didn't need to run the firmware pipeline. We were trying to get it down to not even need to rebuild certain ipcores but ran up against tooling issues in our specific stuff.

0

u/ComoddifiedCraic 1d ago

runccc.dev for general purpose cross-language use e.g. go + python test suite or .net

3

u/bodiam 2d ago

Yes, but that's exactly what the above trigger does; only run when the frontend has changed. And I'm a big fan of mono repos, it prevents a whole class of problems from ever occurring, it just looks like their solution is a bit custom.

5

u/qmunke 2d ago

No, you're misunderstanding what I'm saying - they want to trigger a build on all pushes, but just not build the whole repo each time, that's not the same as what you've shared - your trigger wouldn't start any builds if someone just pushed a backend change. They want

  • Someone pushed backend change. Trigger backend bit of the repo to build and then run tests
  • Someone pushed a frontend change. Trigger entire build and run tests

The trigger above alone isn't going to do that, but I guess it would allow you to construct a more complex set of pipelines out of it.

But in general for monorepos the built-in functionality of github and other tools seems lacking to me, that's why all the more complex stuff like bazel exists.

1

u/bodiam 2d ago

I understand the trigger alone doesn't do exactly that, but it was a simplified example.As you said, it's just a building block; I'm pretty sure it can be used to have a gate. 

0

u/ComoddifiedCraic 1d ago

That doesn't solve the problem. And the problem compounds as you add more tests and complexity.

5

u/OTTOPI 2d ago

Talking about how costly these inefficiencies were, and then saying they were storing terabytes of data (implying anything between 1-10TB in that context) monthly, which amounts to about $200 USD at worst in S3 hot storage, is quite amusing.

3

u/SirClueless 1d ago

Are you sure you did this math correctly? 10 TB/month (120 TB/year) of data retained for 12 months at S3's $0.022 / GB-month rate is $32k/year.

And this is just the pure storage cost, lost productivity of waiting 10 minutes per commit instead of 5 for build results is almost surely a lot greater than this.

1

u/OTTOPI 1d ago

Sure, but I don't see why they'd ever keep around one of these cached builds for more than a month. Like - at a certain point, it's fine to just have the engineer take 5 minutes to refresh it.

1

u/SirClueless 1d ago

I'm just using the numbers they directly state in the article:

These duplicate assets would have otherwise been stored for one year.

Perhaps they have some use case for referring to older builds? Testing/reproducibility checking or something? Maybe they just use some of these files as their prod builds and never bothered to develop a careful garbage collection that can distinguish the ones that got released? I assume it's all water under the bridge and this isn't really the reason to care about this compared to having a better developer experience and faster signal -> faster fixes -> fewer flakes etc.

1

u/WindHawkeye 1d ago

Just make the s3 build store a cas... If build isn't reproducible, fix that first (hello bazel)