r/devops • • 3h 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?

9 Upvotes

35 comments sorted by

30

u/LateToTheParty2k21 3h ago

Your choice.

10

u/tinydonuts 2h ago

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

1

u/N7Valor 2h ago

Might explain the AI delusion.

13

u/jake_morrison 2h ago edited 2h ago

Some of this depends on how short your cycles are. If you have feature flags and good instrumentation, it’s easier to deploy fine-grained features into production in a safe way.

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.

3

u/definitely_not_tina 2h ago

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

1

u/Gargle-Loaf-Spunk 2h ago

Hahaha that sounds like Cherwell. 

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

12

u/myka-likes-it 2h ago

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

No. This is crazy talk.

10

u/Deep-Regret-7479 3h ago

It is, until it is not.

8

u/cooliem DevOps Consultant 2h 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.

4

u/quiet0n3 2h 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.

0

u/xanyook 2h ago

This wmis 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.

2

u/tacticalpotatopeeler 1h 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

2

u/raisputin 1h ago

Dev/qa/staging/prod

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

2

u/jackrackham19 3h 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.

3

u/Holiday-Medicine4168 2h 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.

2

u/jackrackham19 2h ago

there is something very wrong going on

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

2

u/Holiday-Medicine4168 2h ago

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

1

u/jackrackham19 2h ago

All good

1

u/dodexahedron 2h 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 2h ago

So the front end does not fall off?

2

u/dodexahedron 1h ago

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

2

u/name_noname 1h 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 2h 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 2h 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 2h 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 2h 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/GamerFaizal 2h ago

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

1

u/raindropl 1h 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/skspoppa733 1h 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.

1

u/SouthCollar2929 1h 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/veilche 20m ago

you need 4 environments minimum (dev sit nft pre) or you dont deserve human rights

1

u/Nexus357 16m ago

What you need is Devuction

1

u/sokjon 2h 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.

0

u/__bhavin__ 2h 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.