Jamstack Explorers

Up and Running with Serverless Functions with Ben Hong

Introduction with Serverless Functions

ℹ️ About

Let's face it. Serverless functions is one of those terms that's very confusing when you first hear it. After all, "serverless" doesn't really mean that there are no servers. So what does it really mean?

In this lesson, you'll learn what serverless functions are and why people are so excited about them.

Repo: https://github.com/netlify/explorers-up-and-running-with-serverless-functions/

📝 Transcript

Let's face it. Serverless functions are one of those terms that's very confusing when you first hear it. After all, serverless doesn't really mean that there are no servers. Instead, it's more like you don't have to purchase and maintain your own servers. So at the end of the day, serverless functions still require servers.

It's just that instead of maintaining your own servers and having to worry about operations and logistics, you get to focus on solving business problems instead. So why are serverless functions great? Well, to start, it lowers the barrier of entry for developers as they want to extend and build functionality beyond the browser.

Number two, they're quite inexpensive compared to owning and managing your own servers, especially early on in development. Number three, it enables quick deployments and updates that are inherently scalable as your requirements grow. And finally, as I mentioned earlier, it allows developers to focus on solving business problems rather than on operations and managing their own servers to help better illustrate this.

Consider the following here on our planet. We have a base and our base is the equivalent of your website. Its job is to receive visitors and display information for people. Now, these satellites up here, these represent different APIs where we often fetch data in order to populate our website or application.

And so typically we'd go ahead and we'd send data up to request something and then the API would send it back. But then here's the thing. What happens when you want something different from the API? Well, unless you have control or access to the backend engineers who can make a change, this is actually not possible for most developers.

However, what if we could have this intermediary robot and in this case, this robot is a serverless function. And so what we can do is we can send a request to this robot and he can go ahead and pass it onto the API and then return the data back. Now you're probably wondering what's the difference. Well, the difference is now when we send a request onto our serverless function and it goes and fetches it back, we can actually program a robot to send something different back to us.

In other words, we now have much more control over how things are being returned to our application. And so thinking about this across a bigger scale with multiple serverless functions that can then fetch different data, this is really powerful. And to top it off, we could even theoretically combine these serverless functions so that when we send a single request to the serverless function, it'll go ahead and combine that into this single response.

Pretty cool, huh? While sir, all those functions are great. Like any technology or technique, there are some limitations to them. The first is that they're not built for long-running processes. This means that anything that takes longer than 30 seconds typically might require a different approach. Secondly, they're primarily stateless, which means that the serverless functions won't be able to store the currency of the processes.

As it goes from serverless function to serverless function. There are certainly techniques to get around this, but this is an inherent part of serverless architecture. Finally, compared to owning your own servers and having them run all the time, they can have some performance or latency problems. You might hear terms such as cold start, but generally, this doesn't impact a large number of use cases.

With all that said and done at the end of the day, as my coworker, Jason Lengstorf would say serverless functions, ultimately give developers superpowers and enable them to do things that would not otherwise have been possible. I look forward to showing just how easy it is to get up and running with serverless functions in this mission.


your progress