What is Serverless?
Traditionally, we’ve built and deployed web applications where we have some degree of control over the HTTP requests that are made to our server. Our application runs on that server and we are responsible for provisioning and managing the resources for it.
There are a few issues with this:
1. We are charged for keeping the server up even when we are not serving out any requests.
2. We are responsible for uptime and maintenance of the server and all its resources.
3. We are also responsible for applying the appropriate security updates to the server.
4. As our usage scales we need to manage scaling up our server as well. And as a result manage scaling it down when we don’t have as much usage.
This can be a lot to handle. This ends up distracting from the more important job that we have; building and maintaining the actual application. At larger organizations this is handled by the infrastructure team and usually it is not the responsibility of the individual developer. However, the processes necessary to support this can end up slowing down development times. As you cannot just go ahead and build your application without working with the infrastructure team to help you get up and running. As developers we’ve been looking for a solution to these problems and this is where serverless comes in.
Serverless computing (or serverless for short), is an execution model where the cloud provider (AWS, Azure, or Google Cloud) is responsible for executing a piece of code by dynamically allocating the resources. And only charging for the amount of resources used to run the code. The code is typically run inside stateless containers that can be triggered by a variety of events including http requests, database events, queuing services, monitoring alerts, file uploads, scheduled events (cron jobs), etc. The code that is sent to the cloud provider for execution is usually in the form of a function. Hence serverless is sometimes referred to as “Functions as a Service” or “FaaS”. Following are the FaaS offerings of the major cloud providers:
AWS: AWS Lambda
Microsoft Azure: Azure Functions
Google Cloud: Cloud Functions
While serverless abstracts the underlying infrastructure away from the developer, servers are still involved in executing our functions.
Why Create Serverless Apps?
There are a few reasons why serverless apps are favored over traditional server hosted apps:
1. Low maintenance
2. Low cost
3. Easy to scale
The biggest benefit by far is that you only need to worry about your code and nothing else. The low maintenance is a result of not having any servers to manage. You don’t need to actively ensure that your server is running properly, or that you have the right security updates on it. You deal with your own application code and nothing else.
The main reason it’s cheaper to run serverless applications is that you are effectively only paying per request. So when your application is not being used, you are not being charged for it.
Benefits of Serverless Architecture
From business perspective
1. The cost incurred by a serverless application is based on the number of function executions, measured in milliseconds instead of hours.
2. Process agility: Smaller deployable units result in faster delivery of features to the market, increasing the ability to adapt to change.
3. Cost of hiring backend infrastructure engineers goes down.
4. Reduced operational costs.
From developer perspective
1. Reduced liability, no backend infrastructure to be responsible for.
2. Zero system administration.
3. Easier operational management.
4. Fosters adoption of Nanoservices, Microservices, SOA Principles.
5. Faster set up.
6. Scalable, no need to worry about the number of concurrent requests.
7. Monitoring out of the box.
8. Fosters innovation.
From user perspective
1. If businesses are using that competitive edge to ship features faster, then customers are receiving new features quicker than before.
2. It is possible that users can more easily provide their own storage backend(i.e Dropbox, Google Drive).
3. It’s more likely that these kinds of apps may offer client-side caching, which provides a better offline experience.
Drawbacks of Serverless Architecture
From business perspective
1. Reduced overall control.
2. Vendor lock-in requires more trust for a third-party provider.
3. Additional exposure to risk requires more trust for a third party provider.
4. Security risk.
5. Disaster recovery risk
6. Cost is unpredictable because the number of executions is not predefined
7.All of these drawbacks can be mitigated with open-source alternatives but at the expense of cost benefits mentioned previously.
1. Immature technology results in component fragmentation, unclear best-practices.
2. Architectural complexity.
3. The discipline required against function sprawl.
4. Multi-tenancy means it’s technically possible that neighbour functions could hog the system resources behind the scenes.
5. Testing locally becomes tricky.
6. Significant restrictions on the local state.
7. Execution duration is capped.
8. Lack of operational tools
Unless architected correctly, an app could provide a poor user experience as a result of increased request latency.
At Mobio Solutions, our team has ingrained the knowledge of Serverless design with the experience of turning out multiple web and mobile app solutions successfully. Feel free to connect back on email@example.com and we would be happy to discuss this further.