In the past couple of months, there's been a lot of discourse over serverless applications. It's kinda an argument that never ends but this time it seems to be caused by Vercel changing their billing. A few users have complained about their bills being increased multiple times. A few weeks before that there was another incident where a Netlify user shared their enormous Netflix bill on Reddit and subsequently on HackerNews.
When I started this blog, I wrote an article where I recommended deploying to VMs/servers. And I stand by that even today. There are two, compelling reasons for that:
- Servers are easy to deploy to and maintain
- Servers are simple(r).
In serverless there are many areas where things can go wrong. A lot of those places are not in your control and are abstracted away from you in the name of developer experience. Don't get me wrong, I love a platform with good developer experience. I love not having to think about CI/CD. I love when all I have to do is "git push". And most of what I build is deployed using a serverless platform like Vercel, Netlify, or Cloudflare. But I only use them for simple websites. Anything more than that I always choose to deploy to a server or with docker on a platform like Fly or Railway.
But what about scale? Oh, the serverless people love to use this argument. Serverless scales infinitely. Sure, so does your bill.
At one of the startups I worked at, we ran the business for over 3 years on a single EC2 instance. Then we added more instances and put them behind a load balancer. Only then we started to split of small pieces of functionality and moved them to Lambda functions. The primary business still runs on VMs.
I think all the praise for serverless is the result of really good marketing. Platforms like Vercel have empowered frontend engineers to deploy their apps. There are some great companies that have built great products that are deployed on serverless platforms. You might even like to not think about how your apps are deployed and you just want to build stuff. That's great.
So just use a server. Split off small features and move them to serverless when you see drops in performance. Or when you're building stuff adjacent to your primary product.
A single VM will take you a long way. A very long way.