There was an interesting Twitter thread yesterday about the tradeoffs of going serverless.
what is the biggest tradeoff of going serverless ?— Brian LeRoux (@brianleroux) August 3, 2021
There are indeed many such tradeoffs. Serverless approaches offer many benefits, in particular the potential for cost savings (at least in the early stages of a project’s lifecycle) and the chance to offload what would otherwise be a lot of operational management work on to the cloud provider, letting you focus on your building your business and not an abstraction castle.
Potential for greater complexity
This isn’t even an exaggerration of the complexity of most serverless and cloud architectures I have worked with. Cloud providers like AWS and GCP make it very easy to add ever more nodes to the architecture diagram, as they are more than happy to charge you for all of these managed services. This needs to be balanced against the potential for cost-savings by handling the fundamentals yourself, and of course the eternal benefits of keeping things simple.
Lack of observability / lack of ability to audit
Observability, if someone know good tool for that then please refer— Nishchit (@Nishchit14) August 4, 2021
Because serverless approaches can make it easy to continually add more and more individually deployed functions, there can be a combinatorial explosion of potential execution paths through the distributed system as the functions interact with each other in myriad ways. This can make it difficult to observe what is happening at the logical level, or to track down bugs hiding amongst obscure edges in the execution graph.
This point might be more debatable than the rest, as there is an argument that you get better observability with serverless architectures because you can easily separate out compute, storage, running costs and so on down to the function level.
Database connection count
lack of keepalive? weirdness of connection pooling/inability to just use some databases? vague resource specifications from some of the vendors?— Tom MacWright (@tmcw) August 3, 2021
I can’t get over the fact of these restrictions for Data API in Aurora Serverless since it doesn’t support RDS Proxy. pic.twitter.com/tihw2XE02l— Eduardo Urias (@larsx2) August 5, 2021
Pretty much every company that uses serverless is going to hit the max database connections issue. With every function invocation in its own container demanding its own database connection, its easy to exceed the maximum number of concurrent connections that the database can handle.
Having said that, this was already a problem with elastic autoscaling servers in the cloud – it’s perfectly possible to scale up enough servers to exceed your database’s max connections limit.
There are various solutions to this, including database connection pooling, CQRS, read-replicas and so on.
I'm still deeply uncomfortable committing to vendor lock-in against a closed-source serverless platform - one of the reasons I like Cloud Run so much is that it's just Docker containers, which I could always run somewhere else if I absolutely had to— Simon Willison (@simonw) August 3, 2021
Another common objection to serverless approaches is the high potential for vendor lock in, as you’re tied into the serverless technology of whichever cloud platform you use. Cloud providers tend to encourage this by pushing features such as vendor-specific function triggers that tend to rely on use of their SDK to be convenient.
If you treat serverless as more of a deployment strategy than an architectural paradigm, you might be able to mitigate this issue to some extent by depending less on vendor-specific offerings, or at least depending on them less directly.