Serverless cloud products are all the rage right now.
You have serverless computing, serverless databases, serverless storage, serverless
messaging, and much more.
What's this hype all about, and is it justified?
But first, what's a server?
A server is basically a computer designed to run 24/7 and provide services to other
people on a network.
If you've been using the internet in any way, you've interacted with hundreds of servers.
Web servers that send you web pages, mail servers for communication, file servers to
store your files, game servers for entertainment, and so on and so on.
This is what a server looks like, and they are designed to be fast, have a lot of memory,
and a very speedy internet connection.
They're usually housed in massive data centers, like this one from Google.
The problem with servers, however, is that they're not flexible.
Hosting your own website on your own server is cool, but if you only have a handful of
visitors each day, your server will be idle most of the time.
This is called over-provisioning.
You're paying for a server that has a certain capacity, but you're not using it, so most
of it goes to waste.
The opposite of this is called under-provisioning.
Your server gets overwhelmed by many visitors trying to load it at once.
The server will run out of capacity and crash.
Predicting how many resources you will need to run an online service is almost impossible.
Any service could turn into an overnight success or, it might grow slowly for many years.
If you under-anticipate the traffic, your service will be slow or go down.
Over-estimate, and the server costs will burn a hole in your pocket.
And aside from scaling, servers also require a lot of maintenance.
You have to update software, replace failed hardware, make sure they have reliable internet
connections, and so on.
All of this means you can focus less on developing your website or service.
To solve these issues, cloud providers introduced "serverless" products.
They allow you to run an online service without having to worry about servers or other underlying
infrastructure.
This leaves you to focus entirely on your application.
Want to create a filesharing service?
Use a serverless storage product, and you can store millions of files without worrying
about having enough hard drives to store them.
Want to track your sales?
Use a serverless database, and you'll be able to store, create, and fetch millions of records
every second if needed.
There are three main benefits to serverless products: you only pay for what you use, they
easily scale up & down, and you don't have to manage servers.
Let's go over these in more detail.
First up, Serverless products charge you for your actual usage.
For instance, per gigabyte of stored data or per 100ms that your code is running.
That's advantageous when you're not using the same amount of resources all the time.
And this is quite common.
Websites usually see ups & downs in traffic, depending on who your website is targeting.
A business-oriented website might see a lot of traffic during business hours, but almost
none at night.
When using regular servers, you would have a fixed cost throughout the day, regardless
of wether, you have a lot of traffic or not.
Another benefit is scalability.
Serverless products are build to cope with huge demands.
Hosting a small website with just a handful of visitors is fine.
But if your website suddenly starts to get millions of visitors, that's fine as well.
Behind-the-scenes, the cloud provider, will allocate more servers to your website, and
as traffic goes down, so will the number of servers.
In fact, that's how my website is hosted on AWS.
They take care of all the details for me.
All I have to do is upload my website, and I'm off the hook!
Again, hosting on your own servers makes this much more complicated.
Increasing capacity means buying more servers and configuring a load balancer to balance
visitors across two or more servers.
Much more challenging and time-consuming.
So, in a nutshell: with serverless, you never have too little or too much capacity.
It's always just right.
The last benefit is something that I mentioned a few times now: you don't have to manage
servers.
That includes, not having to buy equipment, not worrying about having the latest security
patches installed, no hassle when hard drives die, and most importantly: no growing pains
when your site or service sees a spike in traffic.
You also don't have to worry about upgrading and replacing your equipment at the end of
their lifespan.
Which, for servers, is every 3 to 5 years.
I might sound like a big fanboy, but there are downsides as well.
For starters, because serverless products scale so easily, and they only charge you
for what you use, it can be tricky to estimate how much you will have to pay.
Also, every serverless product has a certain amount of features that are all priced differently.
In that sense, renting or buying traditional servers is much more predictable.
For a given price, you will get a certain amount of server capacity.
No more, no less.
Another downside is that each cloud provider has its own specific serverless products,
and they aren't necessarily compatible with one another.
Meaning, you risk getting locked in by the cloud provider.
If you don't pay attention to this, you will become very dependent on them and switching
to another provider might become a huge and expensive effort.
Serverless databases are a great example.
All cloud providers have them, but all of them support a different set of features.
When you then depend on such a feature, it might be impossible to move to a competitor
without re-architecting your site or service.
In fact, serverless products are probably the best way for cloud providers to tie you
to their platforms.
However, tools and techniques exist to overcome this challenge and build cloud-agnostic applications.
And finally, serverless isn't a solution for just about anything.
To give a few examples, Serverless databases often pose limits on how you can query your
data.
Serverless compute products limit how long your code can run to just a few minutes.
And sometimes, serverless products are just slower because they're dynamically changing
the capacity allocated to your website or application.
That being said, new products are frequently announced and existing ones are getting better.
Just be aware of some of these drawbacks.
Before ending, I just want to say that "Serverless" is actually a bit of false advertising.
Server-less doesn't mean "no servers".
It's just that you don't have to worry about them anymore.
But cloud providers still have hundreds of thousands of them.
The term "wireless" is equally misleading in the same way...
Thanks for watching this video.
Subscribe if you found it interesting, and I hope to see you next time!