>> Use cases for Serverless.
In this video, we're going to talk about when it's a good idea to
use Serverless and when it's not such a good idea.
Serverless is not always the right technology.
Here are some general rules of thumb that you can apply to
any operation to see if Serverless would be a good fit.
Serverless is good for any operation that
experiences low or burstable traffic.
What I mean by burstable is that
the operation may be rarely
called or it may be called a whole lot.
But we don't know.
So it's now called it all and then it's
called thousands of times within a few seconds,
then it goes back to being not caught at all
a few seconds later and stays that way for a long time.
This is erratic and burstable traffic.
The reason for this is cost.
You only want to pay when your function is running.
If you are building a system with a lot of
high traffic and a lot of load or predictable demand,
Serverless might not be the best option
for you because you might actually end up paying more.
In that case, you might want to look at
traditional hosting systems like a virtual machine and,
or an actual platform as a service like
Azure's application service where you can
prepay for a certain amount of compute.
Serverless is a great option,
though for operations and processes that need to be triggered
by other events somewhere else in your system.
This is because with Serverless
you are event-driven and so you don't have
to wire up all of
these events that you need to listen to yourself.
You just tell the function to fire whenever
the event happens and it just works.
Let's look at some concrete use cases are
examples of where Serverless really shines.
Traditional APIs are a great option for Serverless.
These are endpoints that you create
where server acts as the API for your application.
Often the server is just talking to a database and either
retrieving data or making updates on behalf of the application.
This is a particularly great option for single-page applications.
These are applications that are built with
front-end JavaScript frameworks like Angular Vue or React.
In fact,
it's such a great option that Azure functions is built into
the new Azure Static Web Apps offering because it's
just the easiest way to stand up
an API for your single-page application.
Image processing is another good one.
You may have an application that
allows the user to upload a photo.
You then need to resize that photo to make a thumbnail out of it.
Instead of building all that into your application,
what you do is write a Serverless function
that watches for that file to be uploaded
and then takes it and transforms
it into the scaled-down thumbnail image.
This is especially useful if you've already
written the application that uploads the photo
and you don't want to have to crack
that code open and make a bunch
of changes and then redeploy that application code.
You can just write a Serverless function
that does all that for you
without modifying the application whatsoever.
Bots are also a particularly good use case for Serverless because
bots respond to human behavior
and human behavior is unpredictable.
This can be bots like chatbots, bots with auto-reply,
with a message like updating a customer on the status of
an order via a text or a chat message or service bots.
Bots that do things like pulling data are
more information when you paste a link
into Slack or Microsoft Teams.
Human behavior is by definition, unpredictable and erotic.
You don't know for certain how many people are going to
sign up to receive those order updates.
You don't know how many are going to try to talk to
your bot to get the FAQs answered.
You don't know whether a customer will opt out of updates.
Serverless is great for these scenarios
because you don't know how much of
these things will be used and you don't want
to be charged when they're not being used.
In summary, you should use Serverless when you have
low or burstable traffic.
You should also use Serverless when
you need to respond to events that are
happening somewhere else in your system
and he don't want to have to wire that stuff up yourself.
Do not use Serverless if you
have a high amount of traffic and it's predictable,
you can predict the traffic.
In that case, book to traditional hosting solutions,
which might actually give you more bang for your buck.
[MUSIC]