A sample of technical writing via Blog.
What is Serverless – in Laymen Terms
Serverless applications is an interesting name, that really has less to do with the application, and more to do with the technology hosting and storage of the application. Serverless applications do make use of servers, it’s just that they use them differently than in the past.
If you consider an application to be a product, activity, or service, you can in turn also think of the server as the house in which that product, activity, or service is homed. In traditional server systems, that house is static, probably like your house, or mine.
In the current “Serverless” system, you can have that same product, activity, and service, but the house can change as the needs grow or shrink- like adding a room when you need more space, or renting that room out when space is not being used.
Serverless technology has benefits for both the server hub, and the producer of the application. Applications using serverless architecture only pay for services when actively using those services- as in executing a process.
Let’s Take a More Technical Look
The most well-known and understood advantage and selling point of serverless computing is that it economizes the use of cloud resources. Serverless providers only charge for the time that code is executing, maximizing the function and profitability for both the provider and developer. Interestingly Serverless has also increased stability due to spinning services/instances as needed and having redundancy built into the system.
The numbers of applications and services that have moved to serverless is a testament to it’s economical use and function.
Additional interesting strengths are even greater costs reduction when multiple applications share common components, and in defining workflows.
Current thoughts on defining and describing serverless include calling it Event Driven, or Function and a Service (FaaS) protocol. Serverless architecture is best utilized to process events, or discrete chunks of data generated as a time series.
How it Works
Data arrives at the application, (via human or endpoint), and the architecture incorporates an API gateway that accepts the data and determines which serverless component receives the data.
Regardless of which host is being used for the applications serverless architecture, the runtime environment will pass the data is to the component, where it is processed, and returned to the gateway for further processing by other runtime functions, or returned to the user completed.
- Application Development
- Developers write code, and deploy to the cloud provider.
- Cloud Host
- Application Code is hosted by the cloud provider, and homed in a fleet of servers.
- Application Use
- Requests are made to execute the Application code.
- The cloud provider creates a new container to run the code in.
- The container is deleted when the execution has been completed
- Usually after a time period of inactivity
Considerations
It’s important to keep in mind that serverless systems are not intended to become complete application. Successful use of serverless requires a separation of data input from computing actions. This separation will affect all stages of development and testing.
Timed out
One challenge is that Serverless isn’t as successful with longer computation times. For example, if processing takes to long, serverless can stop, and require a cold start- it simply may not work for that longer time period. There are some work arounds for this, but they can be problematic. One fix could be to make lots of little computations, that when broken apart, are fast enough to work well in a serverless environment; but the amount of coding time and rebuilding by developers can be prohibitive.
Serverless is Stateless (lack of persistence & it’s impact)
Another consideration is Serverless functions are stateless; individual functions accept input, they process that input, and they output a result. By design, there is no local or persistent storage.
The lack of persistence has impacts in both development and testing. For example, developers in data processing applications often want to be able to temporarily persist data that may be needed a few steps along, and testing can depend on maintaining a state from one step to the next in a workflow, results of previous operations can be understood as input to subsequent steps.
It becomes challenging to test more than one function at a time, and to replicate a serverless system for testing of a process that may use multiple functions is not always possible.
The most common approach is to break the development & tests into even smaller processes. It requires a heavy lift at the beginning, for a transformation of the workflow, as well as greater breakdown in understanding development and testing coverage into micro units, rather than full processes.
Some testing and developers have resorted to ad hoc methods of persisting data, such as creating and writing files to a cloud database. This can make an application more difficult to maintain, and could have security impacts depending on the platform/product/material being stored.
Major providers now have documentation and best practice methods and work arounds for providing persistence. AWS has introduced Step Functions, Microsoft Azure has Durable Functions and Logic Apps, and there are open source add on solutions as well.
Wrap Up
Serverless – or Function as a Service is one of the greatest transitions in recent computational history and demand. As the cost of moving data becomes more affordable, relative cost then increases on the storage or computation. Serverless architecture is a leap forward on this, moving our storage and computation from a static system to a kinetic system allowing for peaks and valleys to be represented and carried over in both costs and savings for providers and consumers. Finding a way to distribute the costs of both storage and functions based on use in a live and active manner is a huge leap forward, and we are still at the beginning stages of this.
What’s coming to Serverless? Things to keep an eye on include security, persistent storage, and data integrity. Global Serverless Computing Market is expected a compound annual growth rate of more than 22% in the period between 2024-2031.1
Other related and interesting content can be found at the following:
- CLOUDFLARE – What is Serverless Computing
- IBM – What is Serverless Computing
- What is the Runtime Environment
- Understanding Runtime & Applications