NHSDigital / software-engineering-quality-framework

🏎️ Shared best-practice guidance & tools to support software engineering teams
145 stars 35 forks source link

Serverless is harder to test #48

Open arctangent opened 4 years ago

arctangent commented 4 years ago

Regarding: https://github.com/NHSDigital/software-engineering-quality-framework/blob/master/practices/cloud-services.md

Ref: "Prefer serverless platform as a service (PaaS) over infrastructure as a service (IaaS)"

I think it is important to recognise that serverless architecture is a good example of TANSTAAFL [1]. What you gain in simplifying the infrastructure you often lose (and more) due to the additional difficulty of testing and debugging a distributed software architecture.

The problem is often not with the code itself, which can be unit tested, but with how to test the config and integration with other services. It's easier to build an IaaS stack locally than it is to mock out cloud services on your development machine.

I'd suggest we say that serverless is useful for isolated (or isolatable) components, especially those where demand tends to be "bursty" e.g. processing user signups, but that IaaS has benefits where the system has many interdependencies (assuming that deployment monolithically via IaaS is a realistic alternative).

[1] https://en.wikipedia.org/wiki/There_ain%27t_no_such_thing_as_a_free_lunch

stefaniuk commented 4 years ago

@arctangent I think you are talking about the granularity of the system components. It's always a good consideration to be able to articulate how we ended up making choices on how "micro" our components are. However, the sentence you are referring to does not imply the size. An application deployed to a managed serverless offering can still be monolithic - not trying to say that this is a good thing.

I would say that whenever we choose to build our system on a serverless platform we should document how we made that decision, as this is more important than the decision itself.

ivorc commented 4 years ago

It's a good point, @arctangent, but as @stefaniuk says I'm not sure it relates to this item so much as patterns/architect-for-flow.md, which does have exactly the kind of cautionary warning you're raising in the Caveats section. Are you happy to close this one?

arctangent commented 4 years ago

I think the statement that one should "Prefer serverless platform as a service (PaaS) over infrastructure as a service (IaaS)" is misleading as it isn't always the best choice.