A Short Introduction to Serverless Computing
Serverless computing, despite its name, requires servers – but it does free up developers and IT engineers from managing server hardware and allows applications to run on-demand, making it an ideal approach for certain use cases.
![A Short Introduction to Serverless Computing A Short Introduction to Serverless Computing](https://eu-images.contentstack.com/v3/assets/blt8eb3cdfc1fce5194/blt9776829a53de0c70/6621138a5223ad81e919b4a3/softwarepromo_0.jpg?width=1280&auto=webp&quality=95&format=jpg&disable=upscale)
Serverless computing is an application deployment paradigm that allows applications to run on-demand, consuming only the resources required to execute them. In contrast, with traditional computing models, applications operate (and consume resources) constantly, even when they are not handling user requests.
Applications deployed using a serverless computing strategy are usually called serverless functions. Services for executing serverless functions, such as AWS Lambda and Azure Functions, are available from public cloud vendors. Developers can also set up serverless environments themselves either on cloud-based or on-premises infrastructure using platforms such as OpenFaaS and Knative, which are open-source serverless computing engines.
The term “serverless computing” – sometimes called event-driven computing – is a little misleading because serverless functions require servers to run. However, the server resources are managed “under the hood,” with each serverless function being executed on-demand by a serverless orchestration engine. Thus, although serverless computing environments depend on underlying physical servers, there is no server hardware or operating system environment to manage for developers or IT engineers who deploy serverless functions.
How Does Serverless Computing Work?
Developers and IT engineers normally first deploy serverless functions into a serverless computing environment – which, again, could be a cloud-based service or an environment that they configure and manage themselves. The functions can be complete applications unto themselves, or they can be application components, such as the code required to perform a specific type of functionality, like resizing an image or scanning a database.
Next, the team sets conditions that determine when the functions will be executed. For example, developers could configure a serverless function to execute when it is requested by another application.
From there, the serverless computing environment automatically executes functions when the preconfigured conditions are met. Apart from the disk space required to store the function code, which is usually minimal, the functions consume no resources unless they are running. (Serverless environments may cache some resources to keep serverless functions “warm” in case they are called repeatedly in a short period of time, but the resources allocated for this purpose are less substantial than those required to run a traditional application.)
What Are the Benefits of Serverless Computing?
Serverless computing provides two key benefits: simplified application management and more efficient resource consumption – which, in turn, translates to lower costs.
Simplified application management
Because serverless computing abstracts applications from the underlying server and operating system, serverless functions are easier to deploy and manage. Developers and IT engineers don’t need to worry about provisioning servers with an operating system, installing applications in the traditional sense or configuring the various resources (like user accounts, file systems and software libraries) that are necessary to run a conventional operating system environment.
Instead, serverless computing enables them to focus just on their code, rather than on the environment that hosts it.
Resource and cost efficiency
Because serverless functions only consume resources when they are actively handling requests, they are more efficient than conventional applications that run constantly, even when they are not being used.
Such efficiency means that more serverless functions can be hosted on a single server, assuming the functions don’t all execute at once. It also means that the cost of deploying applications (or application components) via serverless functions is typically lower, especially when dealing with compute- or memory-intensive applications.
With a conventional application, organizations pay on a continuous basis for the compute and memory resources the application may require during times of peak demand, even if it doesn’t use all of those resources all of the time. (Autoscaling policies to provision resources may mitigate this waste to some extent, but not totally.) In contrast, with serverless functions, businesses pay only for the resources that the functions consume. There is no money wasted on resources that are allocated to the application but that are not actually used by the application.
What Are the Drawbacks of Serverless Computing?
While serverless computing is a useful strategy for deploying some types of applications – especially resource-intensive ones – it’s not the right approach in every situation, as there are a number of drawbacks and limitations to using it.
Platform dependency
To date, there is relatively little standardization surrounding serverless computing. Each serverless cloud service or platform requires serverless functions to be built, deployed and managed in a different way.
For this reason, serverless functions tend to be platform-dependent, making it difficult to move from one serverless computing environment to another without making significant changes to your functions and the rules used to manage them.
Limited visibility
Because serverless computing abstracts servers and operating systems from the teams that use serverless environments, it can be harder to debug functions. While most serverless platforms provide some form of logging, usually you can’t inspect the full operating system logs or trace requests across the entire hosting stack to troubleshoot issues. You are limited to the level of visibility that the serverless environment supports.
Security challenges
There is nothing inherently insecure about using serverless computing. However, serverless environments can be more difficult to secure in some respects. The lack of full control over the host environment means that you can’t take advantage of security tools or monitoring that operate at the operating system level. You are also limited to whichever access-control tooling the serverless environment supports. And most serverless functions run on shared servers, meaning that you can’t isolate your functions from those of other teams or organizations to mitigate the risk of having security issues in other users’ functions affect you.
Cost
While serverless computing is a great way to save money on resource-heavy operations that only need to be performed periodically, resources consumed in a serverless environment usually cost more than those consumed via conventional application hosting (at least in the cloud). In other words, on a per-unit basis, you’ll pay more for the compute and memory that your serverless functions consume than you would if you ran the same code for the same amount of time in a VM.
Examples of Serverless Computing
Serverless computing isn’t the right approach for every use case, but serverless functions are deployed successfully in a variety of common settings.
Data analytics
Parsing and analyzing large volumes of data tend to require substantial compute resources. This makes data analytics a good use case for serverless computing, especially when analytics only needs to be performed periodically.
For instance, if you have an application that needs to analyze a database every hour, you could run the analytics functions in a serverless environment. That way, you don’t pay for the requisite compute resources unless they are being actively used.
CI/CD operations
Certain operations within software delivery pipelines that use a CI/CD architecture may also be performed using serverless functions. For example, application builds, which typically require a significant amount of compute resources and only happen periodically, could be executed using serverless functions to improve the resource efficiency of the overall CI/CD pipeline.
File conversion
File conversions are another excellent example of how serverless functions can be used in the real world. If an application needs to reformat files that users upload or convert from one format (like a Word Doc) to another (like a PDF), serverless functions are a great way to perform the operation on demand, without having to dedicate a continuously running process to it.
Log aggregation and restructuring
If you have an application that periodically collects and/or restructures a large volume of log files, serverless functions are a smart way to do the job. You’ll be able to perform compute-intensive log aggregation and reformatting whenever necessary, without allocating more resources than needed to the task.
Dynamic website generation
Websites that depend heavily on customized, dynamically generated content can be hosted with the help of serverless functions. In this use case, serverless functions would run the operations required to generate the dynamic content when users request it.
Summary
Serverless computing is a powerful technique for simplifying application deployment while saving money. However, due to limitations such as platform lock-in and limited control, it’s important to use serverless functions strategically by sticking with use cases where serverless makes good sense.
About the Author
You May Also Like