Serverless Architectures are probably the coolest technology Iâve seen in the last few years. I think that these architectures will make huge strides in scalability, efficiency, and performance of applications. If you havenât heard of serverless before, letâs first start with a definition:
My definition: Building, customizing, and deploying services to production without maintaining servers.
Industry definition: There are two different meanings: BaaS (Backend as a Service) and FaaS (Functions as a Service). [source]
- BaaS solutions provide functionality that applications use âin the cloudâ.
- FaaS solutions provide event triggered server-side logic with infrastructure managed by a third-party service.
BaaS are cool but have been around for awhile. If youâve integrated with an existing service like Google or Facebook, youâve worked with a BaaS. Iâm excited about working with BaaS databases like Amazon DynamoDB and IBM Cloudant because I donât need to manage database servers. However, they and other BaaS wonât really be my main focus when exploring serverless solutions. They just arenât the interesting service.
However, FaaS are a special kind of magic that makes everyoneâs life easier.
Services like Amazonâs AWS Lambda and IBMâs OpenWhisk provide the infrastructure that makes them work. They provide servers with a basic framework to run functions. These functions, provided by the user, can be heavily customized. Once a function is configured and deployed, the server can begin receiving events. These events are triggered by an event system internal to Amazon or IBM. After the function runs, the service records the stats of the run and bills the function owner. They pay for what they use.
Amazon, for example, bills in metered increments of 100 milliseconds. That means that they will bill you at a given rate for every 100 milliseconds your function is running. Writing faster functions can save you money.
Memory is also a concern and these services will bill in terms of GB-seconds as well. They bill more if your function needs to run with more memory. Cost optimization might be needed to get the run-speed down at the expense of memory and vice versa. That configuration work gives developers options on any given run.
The above is the black-box view I know and love. If youâre more interested in the nitty-gritty of how these services work you can look at OpenWhiskâs source code on the Apache Github page
These two types of services (BaaS and FaaS) set the scene for the âserverless revolutionâ which is currently underway. Massive companies are switching many of their processes over to prevent security vulnerabilities, implement faster, and scale cheaply.
Functions-as-a-service sound awesome! Where do I signup??
Now the simplest service Iâve found to get started with FaaS is Webtask which will allow you to spin up a function on-demand in under 5 minutes. Itâs an awesome way to get started with FaaS with low overhead.
When itâs time to ship to production Iâd prefer to live in an ecosystem with BaaS that I utilize. My current favorite ecosystem is Amazonâs AWS offering. They allow me access to domain customization, databases as a service, messaging queues, content delivery networks, and file storage. My main complaint is that their database offering isnât what I really want, but I like the rest of the services enough to more than make up for that.
Serverless is currently my favorite tool to utilize when shipping AWS Lambda applications. They allow you to build complex configurations of AWS services with CloudFormation from a YAML file. Serverless also has great documentation that helps me walk through complicated configurations. Iâve found Serverless very helpful when iterating quickly.