This introductory article is part of CodeProject’s Serverless Challenge.
Serverless is a term that many developers love to hate.
“Blasphemy!”, they cry. “My code is clearly running on a server somewhere, so it can’t actually be serverless!” And they’re technically correct which is, of course, the best kind of correct.
But it’s possible to be technically correct and still entirely miss the point. While it does indeed run on servers, this fancy technology that trendy developers are calling serverless is actually pretty neat. Even better, it’s built on solid engineering practices that can deliver a huge amount of ROI when used appropriately.
Cloud Computing: Efficiency Matters Again
If you’re still not sold, here’s one last thing that might grab your attention: serverless makes efficiency cool again. For years, we’ve been told that the efficiency of our code no longer matters all that much, because the world is awash in CPU cycles, so we may as well use them!
Notwithstanding the fact that we’re usually told this by hipsters sitting in Starbucks churning out totally awesome Ruby apps while the 27 Electron apps they’re running are draining their MacBook batteries to zero in under an hour, the argument does have some merit. Developer time tends to be expensive, and over the past two decades, CPU time has become increasingly cheap. So it has made sense to be willing to sacrifice some code efficiency to improve developer efficiency.
The cloud has been a great equalizer, however. Companies large and small have been unable to resist the allure of cloud computing. In many ways, it’s nice to be able to outsource all of the headaches involved in procuring, administering, and maintaining your own hardware. Even the company accountants love it! No more time wasted accounting for the depreciation of servers that start out costing as much as a car but quickly turn into oversized paperweights.
There’s a drawback to this convenience, however. The cloud isn’t magic. It’s just someone else’s computer. And all of those somebody elses who offer up their computers via the cloud aren’t bashful about asking you to fork over large sums of money in exchange for you using their CPU time. And they ask you to fork over even larger sums of money in exchange for using their RAM!
Lest I seem like a grumpy old curmudgeon, I think that this is usually a good tradeoff for startups and large enterprises alike. Being able to spin virtual machines, databases and a huge number of other services up and down at will is amazing. Not having to deal with the headaches associated with owning server hardware is even better.
Cloud Computing: Cost Efficiency
Since cloud services are relatively expensive, ideally you’d like to use as little as possible. This brings us back around to software efficiency. If you write efficient applications, you’ll need to use fewer computing resources to run them. In traditional cloud hosted VMs, this translates into being able to run fewer VMs, with less CPU power and RAM assigned to them. If you’ve looked at the price of cloud VMs, especially those with lots of RAM, you’ll know how expensive they are.
Even if you write efficient code and therefore need fewer cloud VMs, there’s still lots of waste. To a certain extent, you can scale the number of VMs up and down depending on load. But those VMs aren’t all at 100% utilization all of the time, so you’re paying for resources you aren’t actually using.
Serverless computing takes efficient cloud computing to its logical conclusion: you pay only for the time your code spends executing, and the memory it actually uses. So although it’s technically running on a server, you never need to actually think