Let’s clear something up right at the start: serverless computing doesn’t mean there’s no server (like, for example, with peer to peer networking). Serverless computing (often called just “serverless”) describes a cloud based architecture and framework that allows the building and running of code applications without having to manage or scale the server infrastructure yourself.
More specifically, a serverless application is a collection of functions that are each responsible for a single task (for example, saving a user choice to a database), and are hosted in the cloud. These individual functions are constructed and activate within milliseconds in response to user actions or network requests, but their hardware resources can be reclaimed when they become idle or are no longer needed. Serverless computing allows different components of an application to be not just stored, but executed from the cloud. It’s the execution part that’s the key.
With traditional server-based computing, the developer not only creates the application but must also deploy or rent appropriate server hardware to host their service. That includes the server itself, the database application layer, managing certificates for authentication and security processes, etc. The developer not only pays for the physical server, they pay for the energy to keep it powered and cooled 24/7, backups, software and hardware updates, and the system administrator who keeps it all working (and fixes it when it doesn’t).
Advantages of Serverless to Developers
With serverless, developers enjoy:
- Freedom from building and maintaining servers and all the headaches that come along with it, including:
- Managing repairs
- Dealing with downtime situations
- Keeping track of security updates and ensuring they’re installed
- Upgrading outdated hardware
- Reduced risk. Serverless platform providers have dedicated systems and processes in place to manage information security and data integrity.
- Automated scaling of infrastructure as demand grows, so if users are really making use of your app you don’t have to worry about slow performance.
- An added bonus, serverless usually costs less, as they leverage economies of scale. As a general rule you only pay for the computing power you use. With traditional computing you pay for a fixed suite of hardware regardless of how much of the server’s resources you actually consume.
Developers are free to focus on business logic and creating great applications for users, without having to worry about the nuts and bolts. This, combined with function-based architecture, results in faster creation and deployment of the application.
There can be disadvantages to serverless, especially if you don’t choose your serverless environment carefully.
- High latency. Most serverless environments can be slow to execute code functions.
- Mitigate this by transferring to EDJX, which launches from coldstart in under 50 ms. EDJX also uses edge computing to mitigate geographic latency.
- For some developers, serverless may require some changes in architecture patterns. If you’ve been working with traditional patterns, you’ll need to shift to more event-driven, asynchronous, and distributed patterns.
How Serverless Applications WorkAs mentioned, with serverless instead of running your entire application from your own server, you’re breaking up your application into smaller functions and running them over the internet. Each function is very limited in what it does, and so is faster and easier to create, test, and even change down the road.
Serverless applications can leverage the client’s computing resources, the server, and even third-party BaaS (see below). The exact configuration is determined by the developer.
For example, the front end of an app could be client side, but it would connect to a serverless application code. Here’s a very simplified example of how a serverless application could run:
- The client using the application performs and action
- A third-party BaaS authenticates the user
- The trigger notification proceeds to the server
- The server locates the right function and loads it into a container
- The code is executed, and a response object created
- The response is sent to the client
- The container terminates after a timeout
There are many different ways a serverless application can be structured, but they all share a decentralized approach: the client-side application is doing some of the work, as are the server-side functions and third party applications.
Other Cloud Service Models vs ServerlessServerless is just one of several types of cloud computing.
Whenever someone refers to something being on “the cloud”, really they could be referring to any kind service that’s delivered over the internet. But not all of these services are serverless applications on their own, since cloud services can be almost anything.
Key Types of Cloud Services - and Whether They Are (or Aren't) "Serverless"
1. IaaS (Infrastructure as a Service)
IaaS was one of the first uses of the cloud. It’s basically an online-access data centre. This includes the physical building, the computers in them, everything that goes into running them, and all the security software and firewalls that protect the servers. As a developer, you purchase a set amount of space, whether you use it fully all the time or not.
You could use IaaS to host a website, to store files, or to access massive computer networks to perform massive computing tasks like weather forecasting.
Serverless computing or not: not. Infrastructure is one part of serverless, but it’s not everything.
2. PaaS (Platform as a Service)
PaaS requires IaaS, and builds on it. PaaS goes further than IaaS by providing a software layer that includes things like operating systems, database management, development tools, and even analytics.
While PaaS allows for the development, testing, and deployment of applications, on its own it’s not serverless. For serverless, you still need a few more things.
PaaS should not be confused with a straight-forward platform, which is an online environment that allows users to do things. Ebay and Facebook are examples of platforms.
Serverless computing or not: not.
3. FaaS (Function as a Service)
FaaS is synonymous with serverless. A truly serverless application is broken up into functions, which respond to user events with a single action. If there are no user actions, there’s nothing running.
With serverless, storage space, memory, bandwidth, and computation resources are allocated dynamically based on user demand at the time. This is what makes it so cost effective and efficient.
Serverless computing or not: yes. Serverless computing includes IaaS and PaaS, but only when you add FaaS do you get fully serverless applications.
BaaS (Backend as a Service)
There’s a lot of overlap between BaaS and serverless but they’re not the same thing. In both systems, the developer doesn’t have to worry about all the supporting elements, they just write the front-end application. The difference lies in the structure: while serverless is broken into functions that are generated spontaneously in response to user actions, BaaS can be constructed any way the developer wants, and are generally left running all the time.
There are some functions that need to be a part of any application, including user authentication, or routing. In serverless applications, these types of functions may be left running as BaaS.
CaaS (Container as a Service)
This is a service model that allows users to virtually create, manage, and use containers in their applications. A container is a software program that includes everything it needs to run on any computing environment. It includes objects that are organized and accessible by specific rules. Containers are faster to load and run because they don’t need to include things like entire operating systems, the way virtual machines do.
Container-based architecture is different from serverless architecture. Containers live on one machine and access its operating system (though they can be moved). The number of containers used is fixed, and determined in advance by the developer, as opposed to serverless which scales dynamically depending on how many user requests come in. Containers are always running, and even though they respond in seconds, are not as fast as serverless, which respond in milliseconds.
SaaS (Software as a Service)
You’ve probably heard of this term but it’s completely unrelated. It means software that you use over the internet. GMail and Salesforce are some commonly used examples. With these tools, the providers manage everything, and you interact with it as an end user (either for free or a monthly or yearly fee). You can configure it within allowable parameters, but you can’t make code-level changes.