r/devops • • 5d ago

Discussion Why so many environments?

I’ve worked at a lot of big companies and they always use 4+ environments to promote code. But processes are so dysfunctional that all the layers don’t reduce prod risk.

Are any companies saying to themselves, “it’s faster, cheaper, AND less risky to mostly edit in prod?

85 Upvotes

102 comments sorted by

97

u/LateToTheParty2k21 5d ago

Your choice.

66

u/tinydonuts 5d ago

There's an overlap missing here that more and more companies are just killing it at: slow and bad.

10

u/SamurottX 5d ago

I'd say that's the cheap part of the diagram but many companies still end up paying a fortune on consultants and thought leaders

1

u/LordGramis 4d ago

Its there in the black area written in black

0

u/abotelho-cbn 5d ago

That's not what this diagram means.

2

u/Amekaze 5d ago

This is a good start but like the model of the atom they teach you in school it’s incomplete. There are least 30 other dimensions. What I been running into recently is necessary vs unnecessary. Like at my job right now our build pipelines of one of our projects is literally 10x the code and logic of the project. All because the lead got it into his head that FE build artifacts can only built once , never copied, not uploaded to a centralized CDN, but still available from any environment any that needs it. He vibe coded the entire thing right before I got there because apparently calling the build command on the same code multiple times could lead to different artifacts. But instead of fixing that we now spend like 1/3 of a given week tweaking this build pipeline 🤦🏽‍♂️. And for those curious it’s the way it works under the hood is a custom router than can span environments that uses the domain and request headers to pull the correct build artifact out of a single s3 bucket…

1

u/Dobsen_Runjie 5d ago

pretty much comes down to picking your poison at the end of the day

1

u/N7Valor 5d ago

Might explain the AI delusion.

31

u/cooliem DevOps Consultant 5d ago

"But processes are so dysfunctional"

Yes. That's why they have so many environments. That right there.

To answer your question: Yes. The companies that have their shit together have fewer environments. If they really know what they're doing then they just have prod and non-prod. But there's often a staging area for QA/UAT type work.

7

u/cromulent_weasel 5d ago

If they really know what they're doing then they just have prod and non-prod.

I think you need at least 3 environments. 1 Environment to make your changes into. 1 environment to practice deploying your changes to. And Prod.

6

u/cooliem DevOps Consultant 4d ago

That's what most people do. It's what I see 99% of the time.

That said, the people that have their shit together generally aren't relying on consultants.

1

u/AntDracula 5d ago

I’ve done an environment that was prod and non prod only. You cannot do this if you have any external users. You need to have UAT for a clean environment to demo from.

5

u/alexterm 5d ago

Test, staging, and prod work great for us. Staging and prod are customer facing, test is internal.

48

u/jake_morrison 5d ago edited 2d ago

Some of this depends on how short your cycles are. If you have feature flags and good instrumentation, you can deploy fine-grained features into production in a safe way without huge amounts of testing.

On the other end of the spectrum, I worked with a SaaS client that had 22 different environments. Their release process took three months, with lots of manual installation and testing work. If any issues were found, fixes would spend weeks circling back to the release branch, then get tested again.

They had 4000 MS SQL Server database instances, each with customer-specific changes that had to be validated. Parts of the system were still in classic ASP that didn’t support modern automated testing and had to be manually tested.

9

u/definitely_not_tina 5d ago

Sounds like the core services of an ex employer. I truly miss that job.

8

u/Gargle-Loaf-Spunk 5d ago

Hahaha that sounds like Cherwell. 

Oh except they put us on an iis app pool that served 400 technicians from 512MB of memory. 

43

u/myka-likes-it 5d ago

 “it’s faster, cheaper, AND less risky to mostly edit in prod?

No. This is crazy talk.

10

u/quiet0n3 5d ago

Dev for Dev obviously it's for quick developer feedback so they can get visuals or debug logs.

Multiple test environments. Usually the amount of test environments grow based on how big your Dev team gets. The larger your Dev team the more Devs want their own environments so they don't run into other teams changes to other apps or other parts of the same app. Or it could be the mobile team etc.

You need good coordination when going to prod. We did this by having a beta environment.

All changes set to go out in the next release go into that environment for the testers to do full UAT with all the planned changes all together. We only deploy things that passed beta.

5

u/xanyook 5d ago edited 5d ago

This is what is wrong in the industry. You should be able to unit and integration test locally: mock for unit, container test for interfaces, and some good e2e tests tools. So if you re bad, 3 environments max including dev test prod.

Reduce to dev and prod if you have a good test strategy with automation.

5

u/quiet0n3 5d ago

That only works when you can E2E all your services. That's like zero tech debt. Might work for a modern company that knew not to build tech debt. But for a lot of big orgs I have worked with they have been running computers since the 90's and building tech debt from day one lol

2

u/xanyook 5d ago

I dont see the link, worked on many platforms for the past 20 years, as a tech lead is this always my goal. You always need to be able to test a service and its interfaces one by one on your local machine and stubbing the client and the consumer. Docker makes thing so much easier. I always pair with a good QA lead to move our Strategy toward that goal.

1

u/randouser196600 4d ago

90’s? I wish. We started in the 70’s

1

u/Speeddymon 5d ago

My current org has 9 environments. Exceptions, lab, sandbox, dev, beta, uat, test, production, training. Of the ones that exist everywhere, there are 7: sandbox, dev, beta, uat, test, production, training.

The lab environment is just an extra Kubernetes cluster so that we can test things without affecting the app teams because app teams use sandbox for their features. The exceptions environment has stuff that can't live in the core 7 because it can't be made to meet policy requirements, hence an exception to the policy is applied on those resources.

Then the app teams use the core 7. I don't know why we need beta when we have test, but we have uat that we use to do DR tests and our QA team uses to do what they do. The training environment is prod-like, and it's for end-user training until they understand the apps enough to be given access to production by our customers so I guess it was a customer requested environment.

Almost nobody does local development and testing because the org for a long time had split horizon DNS, so the VPN couldn't reach a bunch of the resources in the cloud directly. They've since put in conditional forwarders so now everything is resolvable, but teams built out their processes around running builds and tests inside Jenkins for so long that it's just become the norm.

1

u/Express-Acadia-6088 4d ago

That's a lot but I get the essence.

1

u/plaid_rabbit 1d ago

The thing I have a problem testing is when it's part of a larger system and I'm downstream of it. 

For example, I write accounting software, which is dependent on the order being invoiced and money being transferred, etc.  Complex integration tests and validating that the system as a whole works. I've seen large projects done, with beautiful tests and wonderful test coverage, but defects only appear when you run the system as a whole.

And it's usually silly flags that people didn't think about.  "Did you remember to exclude pro-forma invoices when you query the invoicing system?" (Technically it's just a flag, and sometimes you want them, but in this case you don't)  If someone remembered that requirement, sure, but someone has to say that's a requirement, and needs an opportunity to see the system working as a whole to identify the defect.  And it needs to be populated with reasonable looking data. If it's got 5 orders in it, no one is likely going to spot this edge case unless someone remembers to ask about it.  And before it goes live and starts generating finince data based off of that. 

The other problem I run across is ensuring that all the data is configured correctly in the test environments. My code references specific objects in other people's APIs.  But we need to ensure that the external system is setup the way it's supposed to be. I can assume they set it up the way I want it to be, and I can assume the API will return the expected results, but that doesn't help on launch day if the expectations on how the API is supposed to work and how it actually works are different. 

Now, I'm not knocking thoroughly testing your code to the best of your abilities, but you also need tools to handle when you can't get the pretty system design you want. 

1

u/xanyook 1d ago

You need to look at parameterized tests.

If you test each services against their use cases using it, good chance when deployed the end to end scenarios are ok too. Delta is usually Network or infra.

1

u/plaid_rabbit 1d ago

That doesn't address the issue at all, I guess I didn't explain the issue clearly.  You're on the wrong problem.

It's about devs not understanding the business requirements/failing to consider edge cases when providing them to the dev team.  It's not an issue of test implemention/coverage.   It's an issue of the code working the way the developer intended, but not meeting the business need.

1

u/xanyook 1d ago

Still valid, you said you have a variety of dataset as input, i say for a data that is very typed, this is for me the best approach to cover your scope.

let say you have an api then you cover your use cases by parameterized tests , with the extra step of using a Gerkin syntax leveraging Cucumber for example. Then the business can provide the scenario and have the dev implementing them in TDD.

It s just a way of organizing the work differently.

1

u/plaid_rabbit 1d ago

Again, the issue is a level above the issue you're describing, but you're closer.  I've used Specflow, and it doesn't really solve this problem. This is a problem of the requirement not getting captured in the first place, generally because the business forgot the requirement. 

The problem I always run across is the business is poor at generating requirements, and only sees their mistakes when running a full end to end test with live data.

I've tried several tactics, and the only one I've found to be consistently successful is to follow the theory of get as much of the product in front of the customer, on production, as fast as possible and let them review it there.  Anything short of that has been less than successful for me.

Now, I use a lot of automated testing so I don't hit regressions often, I'm not having them test for regressions, I'm having them test the combined new behaviors. 

1

u/xanyook 1d ago edited 1d ago

One time the dev are not implementing, the other the requirements are not transferred correctly... Either way your team is not able to communicate and groom correctly a story including business analyst and dev, or you don't know really what is the problem...

My guess is that it s nothing to do with software but more communication work process. Have a retrospective on the next incident to highlight some improvement.

1

u/plaid_rabbit 1d ago

That's at the right level!  Yes, I've done that retro, and my responses/comments are the result of that. 

The result of multiple retros  is the matching business person didn't raise the requirement until seeing the system running as a whole, due to not considering the edge case.  And I'd say it's a general problem I've seen across multiple projects/multiple companies in my career. 

The only way I've found to identify this type of issue is to provide the business with a test environment that's as close to a clone of production as possible.  If it's just hand selected cases, some edge case gets overlooked.

This is not a grooming issue because the ticket has a good high level description.

It's very much that the business doesn't fully understand the problem they are trying to solve, I won't argue that one bit.  But how can we address it?  The only solution I've found is to present them with a full, realistic dataset from production.   Whenever I do, they surface a large number of issues before launch day, and my launch days go smoother.

And I think this is the hard part of software development.  When the business can 100% accuracy describe what they want, Claude could do the work.  I think the trick is to design a process where you realize there's going to be a gap between the requirements on paper, and what the business wants, and try to streamline the process for reducing the gap.

Also, most of this thinking is coming from doing accounting work on midly complex, high volume systems.  I'm trying to get my error rate as close to zero as possible, I don't have much room for unexplained errors.   Different situations have different error tolerances.  Pricing and accounting have a smaller than average error tolerance.

1

u/xanyook 1d ago

You said the story is correctly groomed then you say you are missing acceptance criterias. That does not make sens.

What you have is a lack of knowledge of your business, shared responsibility between the PO and the BA.

Basically your team now knows that they dont know how things work

Increasing knowledge can come in different ways: training, read specifications, read the code, inprove the test coverage.

Based on what you say, I would add more e2e test to first capture the existing behaviour and use it as specifications. Because the truth is what the code do.

Create a new test module which would be triggered after a deployment.

Capture where those conditional logic appear (those damn if) and have the everything pass green without changing the code. This is now your specifications.

Bring the condition to the business team make them qualify the dataset that verify the test. They need to put business words they understand on the <given when then> test name.

Once you have that, refactor your code to include this vocabulary in your production code: no more if(type=='ABC') but if(myObjectIs<businessWord>) that way you include the domain object vocabulary in your code instead of testing values.

Design pattern will emerge from that and a better architecture will facilitate your maintenance.

Keep those tests as e2e because they are edge cases, they dont need to be checked at each local commit of the dev, they are your safety net from regression.

→ More replies

16

u/Deep-Regret-7479 5d ago

It is, until it is not.

8

u/psmgx 5d ago

less risky to edit in prod

get out

5

u/skspoppa733 5d ago

SOC 2 controls mandate logical separation of environments, so if you provide technology services to others then this choice is already made for you.

5

u/Hummin2k 5d ago

You can pull it off with only two. We have a shared integration testing environment all releases must go through first and production.

8

u/jackrackham19 5d ago

In my experience the management all believes they use the four different environments, and the devs don't have the discipline to keep their hands off of prod.

2

u/Holiday-Medicine4168 5d ago

Developers should not have prod access. DevOps should be limited to break glass only. If those patterns don’t work there is something very wrong going on.

6

u/jackrackham19 5d ago

there is something very wrong going on

gestures around vaguely I feel like we're on the same side of this one.

5

u/Holiday-Medicine4168 5d ago

I just read your comment differently than was intended. My bad

2

u/jackrackham19 5d ago

All good

7

u/raisputin 5d ago

Dev/qa/staging/prod

Pretty goddamned standard and each one should be largely identical to prod

1

u/catcherfox7 5d ago

Use CI/CD and feature flags and you will only need dev and prod.

1

u/raisputin 5d ago

That work in some basic commercial settings, but it certainly doesn’t work in any regulated environment

2

u/catcherfox7 5d ago

I can’t speak for all industries, but I worked in a global payments company on the S&P 500 for a few years; that was our setup.

2

u/AdvancedMeringue7846 5d ago

It works in places, it doesn't work in others. There isn't a one size fits all, it's all abiut risk and reward. Ever heard of the hegde fund that traded themselves out of existence with a feature flag?

https://blog.statsig.com/how-to-lose-half-a-billion-dollars-with-bad-feature-flags-ccebb26adeec

2

u/catcherfox7 4d ago edited 4d ago

I don't disagree. My point is that more often than not, people over complicate the environments setup. They want more envs as argument of safety and stability creating complicated processes without any evidence that they actually work. That's often people brought up by people who never worked with modern engineering practices.

With regards to the feature flag incident, that's a good example of regardless of how many environments you would have, you wouldn't be able to catch the issue. The problem is not the pattern itself, it is how they used.

0

u/Forsaken-Tiger-9475 5d ago

This is absolutely untrue in any significantly sized organization.

3

u/tacticalpotatopeeler 5d ago

No, we have development layer, staging, prod, and sandbox which is basically a stable mirror of prod that can be used to demo new features that may be behind a feature flag and not yet available, and for partners to use as a test environment, etc.

Dev can be broken, staging is a safety check before prod, we can only pick up stable staging builds to promote to prod.

So no, please do not do dev work on prod

3

u/centech 5d ago

Just because a lot of places don't do it well doesn't make it wrong. Just YOLO'ing prod is not a good plan. Especially if you are in any sort of regulated industry.

4

u/GamerFaizal 5d ago

Everyone has a testing environment. Some companies are just lucky enough to have a separate one they call production.

2

u/thelastknowngod 5d ago

This is more of a people question than a technical one. The cultures in some companies are to hire a lot of JR devs. In those situations, it's easier for them to wrap their heads around dev, qa, staging, and prod. In a company that primarily hires Sr level engineers, I would more quickly reach for canaries, feature flags, advanced routing, and modified data handling under test vs promoted to stable.

It's more about knowing your audience than anything.

1

u/dodexahedron 5d ago

Solution:

If it breaks in the prod environment, just take it out of that environment, so it's beyond the environment.

3

u/name_noname 5d ago

So the front end does not fall off?

2

u/dodexahedron 5d ago

But the change control was written to very rigorous systems engineering standards.

2

u/name_noname 5d ago

I especially liked those standards, like only git and no cardboard, nor cardboard derivatives; and when I use k8s there is a steering wheel at the helm, and with AI the new minimum team crew size is finally 0

1

u/MasterOfTheWind1 5d ago

How many environments depends on how big the team is, the type of company (is not the same to develop for a customer facing product than for internal software only) and if the customers have access to some playground for example.

The number of environments by themselves don't say nothing if you don't have a good process of validation.

I've worked on places with dev, stage, rc and production, and the deves clamed that "we can only test on production because of A,B,C", so every environment were pointless.

Every environment needs a purpose and gate conditions that prevents from further advancing to the next.

1

u/Holiday-Medicine4168 5d ago

I have worked with at places that have half a dozen environments per team or per app. There can be hundreds if not thousands, that’s normal for large orgs especially in financial environments.

1

u/xanyook 5d ago

Depends on your build, release and product strategy.

I use to work on a platform where we were doing to push to prod. But i was the lead, and was doing whatever i wanted :)

The idea was that as soon as it was merged on the main, it sas delivered. But i had a dedicated tenant i was able to test on, feature flags and api versioning so my users would not see any test we were doing on production. And a defect would not impact the runnas both n and n+1 version were running in parallel.

We only had pre-production as a training environment.

But i worked on platform with 4-5 environments, waterfall model, promoting the release from one to another, going up the ladder. A release would take 6-9 months.

1

u/snarkhunter Lead DevOps Engineer 5d ago

Isolation - to isolate customers from development, development from testing, etc.

At my place we tend to have a few long-running client-specific projects going on at any given time. Those will often get their own environments, sometimes even their own dev/qa/demo.

1

u/raindropl 5d ago

There are. Lots of variation.

But you want a dev environment we’re all the merges are done. And is desirable to have feature branch environments that set deployed in every commit/merge into that environment.

Once things merge into dev and pass automated testing. They are automatically merged into E2E (End to end testing) where is supposed to be tested actors all related services. Again once it passes testing with could include escaping events and traffic. It turns a green flag indicating it can be merged. Most places will have a human gate keep. More modern teams will have a canary with blue green where changes are either tested incrementally,or be deployed in blue green where rollbacks are almost instantaneous if something is broken.

So 1 (dev) + n(feature branch ) +1 (e2e) + 2(prod blue green)

And some places have a perf. For stress test.

1

u/SouthCollar2929 5d ago

Bro my company is exactly the same. We have four environments and nobody checking my prs. Before I started there was no testing, no typechecking, no error reporting. But merges to main take weeks because we gotta be careful. Careful how? Get some internal users using the new version and if nothing breaks after a while it's good to go.

1

u/Nexus357 5d ago

What you need is Devuction

1

u/adappergentlefolk 5d ago

its cargo culting

1

u/dmikalova-mwp 5d ago

My understanding is that Facebook deploys to prod. They basically have enough trust and validation that they don't deploy problematic code, revert it quickly if they do. A lot of this is done with gating new things behind feature flags.

I'm with you - everywhere I've seen go towards more envs just have more mess. A previous company had a completely dysfunctional staging so to fix that the answer was to create a whole new environment as if that was going to change anything.

1

u/SilentLennie 5d ago

Depends on the size of the team and what you are deploying, a demo, MVP, etc. fine. do it live ! Your problem.

But for a real app, how about just 2 envs ? And check before deploy to prod.

1

u/NoDevelopment206 5d ago

i think the number of environments matters less than whether each one catches something different. a staging that is nothing like prod just adds delay and gives fake comfort. if you can get fast tests, feature flags and an easy rollback, fewer environments works fine. the extra layers make sense when many teams share one big system and need a place to test together.

1

u/VeryShibes 5d ago

Pilot, Dev, QA, Performance, Stage, Prod here.

Most developers here stopped using Pilot and Dev years ago and deploy straight to QA then skip Perf and promote to Stage and Prod. Performance is only if your application is bloated and/or has a ton of outside dependencies and needs to be tuned with APM tools

1

u/riki137 5d ago

Editing in prod is never a good idea. I've worked in companies with 10 environments and the reasoning was so that we can deploy specific features to test for external testers. Maintaing feature flags is definitely more work than maintaining 10 identically programatically set-up environments, especially if you need to do a major refactor.

1

u/hi117 5d ago

I'm going to take a different tack and say that you don't "need" any environment except prod while still following all best practices. The best practices don't say to have a testing environment, they say to test before deploying to prod. For most setups, there's little reason you can't mimic a prod setup (for functional testing at least) on a developer's laptop.

Now for ad hoc changes to prod, that actually happens more than most realize. Every scaling event is a change shipped straight to prod technically. Config changes are more of a risk assessment approach. More specifically, everything is a risk assessment, which is kind of what you were saying to begin with.

1

u/Mean_Guest_5043 5d ago

I think the number of environments matters less than how well they're maintained and how closely they reflect production.

1

u/mrzerom 5d ago

The more active develoonent touching different areas of an app, the more useful it is to have more environments, specially if data security is a concern.

Usually integration > uat > prod is enough. But if your company needs to provide external access to clients, then having a pitch/demo env also makes sense, then you add hotfixes, they should still go through integration tests, but do you bypass uat and go directly to prod? Wont it disturb live development? Maybe add hotfix specific integration testing env, etc.

Everything sounds simple when you're looking from the outside, but unless you have a nutty engineering/architecture lead, environments are created to solve real needs and simplify the sdlc.

1

u/Hostman_com 5d ago

Start with the last three bugs that made it through to production. Try reproducing each one outside prod with the affected build. Figure out whether the gap was in the test data, configuration, a dependency or the test itself.

Use those gaps to decide what to fix or combine. If two environments repeat the same checks under the same conditions, merging them may make sense. If neither catches a known failure, removing one won't fix that gap.

1

u/angellus 4d ago

A lot of it depends.

But generally I do think 4-5 environments is the "right amount".

  • local development
  • integration/CI [could be split out 1 per PR even if you are sophisticated enough]
  • testing (deployed, prod-like, but with test data)
  • [optional, depends on the top of application] 1 for staging/preview (deployed, prod-like, often with prod data, sometime just swap a prod Web server)
  • prod

I have worked at 2 places where we had an environment that was literally prod, but we just swapped a Web server. Same database as prod. This can largely be replaced with feature flags nowadays, but the extra isolation layer was still really nice.

1

u/NoDevelopment206 4d ago

i think the number of envs matters less than how close they are to prod. a staging that has different data and configs just gives false comfort. editing closer to prod can work if you have feature flags and a fast rollback, otherwise one bad change hits everyone at once. does anyone here actually run with only 2 envs?

1

u/nekokattt 4d ago

Any companies saying it is less risky to edit in prod

Probably the ones that have outages every five minutes, or fewer users than developers.

1

u/dogfish182 4d ago

Lots of companies say that. Shit companies

1

u/cliffberg 4d ago

You are right. The four environments thing originates from pre-devops days. With a DevOps approach, you only need a static prod environments - the others should be created on demand. Code changes should be integration tested in a fresh prod-like env, with well-defined prod-like datasets that get provisioned into the dynamically-created test env. And when deploying to prod, you should do a canary deployment and gradually switch over if there are no problems. There is no good reason to have multiple static test environments - doing that is an anti-pattern.

1

u/mcloide 4d ago

In an ideal world, where everything works as intended, you would have:

  • Local → Where developers work on their code in isolation.
  • Dev → The developers' playground and integration environment.
  • Staging → The QA team's playground.
  • Business Review (UAT) → Rarely used, but should provide a production-like preview for business stakeholders to review and approve changes.
  • Prod → Nothing to explain here, right?

In reality, you can comfortably operate with:

  • Local → Where developers work in isolation.
  • Dev → The developers' playground.
  • Staging → The QA team's playground.
  • Prod → Production.

However, when an emergency hotfix is required, what often happens is:

  • Local → Prod.
  • Prod → Prod (direct production modification), followed by cascading the changes down to the other environments.

Neither should be the standard operating procedure, but reality doesn't always respect the ideal workflow.

Having more environments doesn't necessarily reduce production risk. Each environment needs to serve a purpose, and the processes surrounding it need to be respected.

Processes do work. The problem is getting people to follow them (actually good luck with that).

1

u/Aoxite 4d ago

my company does hospital dbms and after we switched to prod only things got so much cheaper and faster it's great 😃

1

u/forest-cacti 2d ago

Sorry in advance for the long reply, but this is something I've been chewing on a lot lately as I reflect on my different engineering experiences.
Before I jump into my thoughts, I'm genuinely curious about your setup:

• What do those 4+ pre-prod stages actually look like at your company?
• Do any of them give you true parity with prod, or are they all watered-down approximations?
• Are you practicing continuous delivery, or are changes batched into scheduled release days?

I've worked on both ends of the spectrum. At one mid-sized company, we had multi-stage promotion and scheduled deploys. Over time, every past outage turned into a new item on a manual pre-deploy checklist. Pushing code became this precious, high-ceremony event where the main goal was avoiding hotfixes, yet things still slipped through because staging never matched real traffic.

Later, I worked in a much larger environment practicing trunk-based development and true CI/CD. Small changes merged to main and flowed automatically through isolated pipeline stages with strict blast-radius controls and automated rollbacks. Even there, though, there was a glaring blind spot around developer experience: leadership demanded thorough testing before you even opened a PR, yet there wasn't a clear, documented way to spin up a safe sandbox to test half-finished work without triggering broken pipeline checks. Telling engineers to "just be more careful" instead of investing in safe pre-merge sandboxes is a massive cop-out.

This has also been on my mind because I recently started re-reading the (20th Anniversary Edition) of The Pragmatic Programmer, and there is an idea right near the beginning that connects directly to this. The authors argue that almost every solid software principle boils down to one rule: Good Design Is Easier to Change Than Bad Design (ETC).

Most people only link that idea to writing clean, decoupled application code, and they stop there. In my opinion, it applies just as much to deployment pipelines and infrastructure.

Every approach has tradeoffs, and multi-stage workflows exist for a good reason: nobody wants to bring down all of production, and true canary testing is genuinely hard to pull off.

If you accept that change is inevitable, though, "easier to change" means prioritizing fast feedback and small blast radii over heavy pre-prod gates, whether that is safe pre-merge sandboxes, single-host smoke tests, or progressive rollouts across isolated clusters or geographic shards.

Even then, a change can pass every pre-merge check and roll out cleanly to the first few clusters before hitting a subtle configuration quirk in a later one, which is exactly why progressive isolation matters.

The biggest realization I've had, especially after building my own home lab setup, is that true dev-to-prod parity isn't just expensive on paper. In many systems, it isn't even architecturally possible.

When I tried to stand up a "staging" instance for my own network controller, I quickly realized you simply cannot have two active instances managing the same underlying physical infrastructure unless you build a whole second network from scratch. Real-world state, external integrations, and exclusive resource ownership mean you can't just clone production into a neat little box.

Pre-prod environments are great for catching deterministic bugs (unit tests, mocked integrations, basic form and API logic). Beyond that, you get way more safety from small, frequent merges, feature flags, contract testing, and progressive rollouts with fast automated rollbacks seems to address the risks that staging layers alone rarely catch.

Of course, this is just my take based on the setups I've worked in. I keep hearing that there are teams out there with genuine pre-prod parity or true isolated canary environments, even though both feel almost mythical from what I've seen firsthand. For folks who have actually pulled off either one, or found a completely different way to ship safely without heavy staging layers, what does that look like in practice?

1

u/zenspirit20 2d ago

Have you measured what kind of bugs get found in pre prod? There is always going to be some prod risk because new code is getting deployed, the question is if the energy spent in pre prod is being spent in desired areas

1

u/tambien430 1d ago

Extra enviroments earn their keep when each one answers a different question since dev stageing and production drift apart the moment configs stop matching Bootdev could help build the backend and deployment base behind such setups though platform docs also map the patterns

1

u/DampierWilliam 1d ago

One environment per developer or app in your product. Then one per stage: dev, qa and staging. One environment per feature demos.
But what we really want as DevOps is the One Environment. One Environment to rule them all.

1

u/sokjon 5d ago

Safely testing in production is a well understood, well-trodden path now. Anyone that suggests otherwise doesn’t understand the techniques and patterns required to do it safely.

Are there benefits to extra environments? Absolutely. But the returns are diminishing after an extra one or two of them. After that they turn into fragility, lag and actually a real risk.

1

u/thisFishSmellsAboutD 5d ago

Microsoft for example seems to do that. Their track record with successful products like Office 364 attests to that.

0

u/__bhavin__ 5d ago

Editing in prod is how you find out which customer was the test case. But you're half right: past the first staging env, most of the extra layers re-run the same checks on the same fake data.

Staging is good at obvious breakage. It won't tell you if the route three people hit a day still works, and neither will the two envs after it. What actually lowers risk is cheap rollback. Run old and new side by side with a small slice of real traffic on the new one, and make going back a weight change on the load balancer instead of a redeploy. Real traffic finds the breakage and most users never see it.

I'd cut environments once the way back is that cheap. Not before.

0

u/Amekaze 5d ago

For me you really only need live 2 non prod environments. The Wild West and the Exact Copy. Anything more requires special circumstances for it to make any sense. From my experience the more environments a place has the worse their local development is because if code can be pushed in a state that completely bricks a live environment then the developer doesn’t have enough resources in the local environment to properly do their job. Deploying code shouldn’t be a step in the middle of a development process.

0

u/catcherfox7 5d ago

That the case of company that I recently joined.

Put the costs in papel, show them the risks don’t disappear with existing practices and what the industry is doing and the see your CTO turn into the biggest advocate for reducing the number of environments.

0

u/addy3006 4d ago

Most extra environments end up as process rather than risk reduction, because staging rarely matches prod's data, traffic or config. I'd keep two: a cheap one for fast testing, and prod. Then lean on feature flags, canary releases and quick rollbacks to catch what staging misses. Editing straight in prod works only when changes are small, observable and easy to undo.

1

u/nekokattt 4d ago

How are you testing against prod load before going into prod with two environments?

Do you run oversized test environments the whole time or change scaling each time you need to do something?

Also, with two environments, how do you develop and test changes to infrastructure without disrupting the work of the rest of your team?

Editing into prod shouldn't ever be done at gunpoint

0

u/Kautsu-Gamer 2d ago

You can create simulated load quite easily as internal networks usually operate lots faster than external network. Any computer can eadily spawn lots of traffic for test env.

1

u/nekokattt 1d ago

That isnt an end to end simulation then

0

u/Kautsu-Gamer 1d ago

The end to end cannot be simulated as network is unreliable, but local network simulation can be used with network layer mistakes simulated. And those cases should have test cases as testing should test failures too.

100% coverage for tests is not possible with any complex system. I did refer that heavy load expecting servers may have a test environment for simulated heavy traffic even surpassing the maximum external network rate.

1

u/Unfair_Worth4366 4d ago

Keeping more environments doesn't always mean better testing. If staging isn't close to production, it can create a false sense of security. A simpler setup with good monitoring and rollback options can sometimes work better.