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.