Serverless business logic
What is serverless? Every application uses servers at some point. The term Serverless emphasizes an architecture and service model where the developers need not concern themselves with infrastructure and instead can focus on the business logic of their appliction. Serverless is the next evolution of architectural design from monolith, to microservices, to functions as Adrian Cockcroft explains in this video:
Serverless, FaaS (Functions as a service), and managed services
Often serverless and FaaS are treated as interchangeable terms, but this isn't really accurate. Serverless is an overarching architectural pattern that makes use of a FaaS along with other cloud managed services. FaaS is a specific type of service such as AWS Lambda, Google Cloud Functions, and Azure Functions, that enables developers to deploy functions.
Attributes of serverless
- Small, discrete units of code. Often services written using serverless architecture are comprised of a single function.
- Event-based execution. The infrastructure needed to run a function doesn't exist until a function is triggered. Once an event is received an ephemeral compute environment is created to execute that request. The environment may be destroyed immediately, or more commonly stays active for a short period of time, commonly 5 minutes.
- Scale to zero. Once a function stops receiving requests the infrastructure is taken down and completely stops running. This saves on cost since the infrastructure only runs when there is usage. If there's no usage, the environment scales down to zero.
- Scale to infinity. The FaaS takes care of monitoring load and creating additional instances when needed, in theory, up to infinity. This virtually eliminates the need for developers to think about scale as they design applications. A single deployed function can handle one or one billion requests without any change to the code.
- Use of managed services. Often serverless architectures make use of cloud provided services for elements of their application that provide non-differentiated heavy lifting such as file storage, databases, queueing, etc. For example, Google's Firebase is popular in the serverless community as a database and state management service that connects to other Google services like Cloud Functions.
Comparison of cloud managed services
Here is a chart of with examples of managed servies from AWS, Google Cloud, and Azure along with their open source counterparts.
||Azure SQL Database
||MongoDB, Cassandra, CouchDB
||Kafka, Redis, RabbitMQ
||Azure Queue Storage
||Istio on GKE
||Azure Service Fabric Mesh
Business value of serverless
- Faster pace of innovation. Developer productivity increases when they can focus solely on business logic.
- Greater stability/resiliency (less loss of revenue due to downtime)
- Greater scale, the software is able to keep up with business demand
- Lower costs. Since compute is only billed when a service is active, servless provides tremendous cost savings vs always-on infrastructure.
Benefits of GitLab Serverless
GitLab Serverles allows business to deploy their own FaaS on Kubernetes.
- No vendor lock-in. Organizations can choose who they want to run their compute. In any cloud that supports Kubernetes, or even on-premises servers.
- Your FaaS is part of the same workflow as the rest of your software lifecyle with a single appliction from planning and testing, to deployment and monitoring.
- Deploying functions is greatly streamlined and simplified vs using Knative directly.
Git is a trademark of Software Freedom Conservancy and our use of 'GitLab' is under license