Serverless computing has become a broad term. With the advent of many providers offering managed Kubernetes, you can build and launch containerized applications without managing a fleet of servers to run your containers.
What is serverless computing, and why should I use it?
AWS says it best:
Serverless is the native architecture of the cloud. Serverless allows you to build and run applications and services without worrying about the underlying servers or physical infrastructure. Serverless environments eliminate infrastructure management tasks such as server or cluster provisioning, patching, operating system maintenance, and capacity provisioning.
Building serverless applications means that developers can focus on their core product instead of worrying about managing and operating servers or runtimes, either in the cloud or on-premises. This reduced overhead lets developers reclaim time and energy that can be spent on developing great products which scale and that are reliable.
Benefits of serverless computing
- Much lower cost if you have short-lived processes or functions.
- Depending on the platform, tight integration with other public cloud services allows for faster development of complex systems.
- It forces event-driven microservices architectures from the start, which lead to more flexibility through loosely coupled services, greater application responsiveness, and an ability to more easily scale wide rather than deep.
Serverless use cases
- Short-lived processes or functions, such as calculating a loan payment, sending a notification, or updating a data record.
- IoT device interactions, such as processing incoming sensor data or signaling a remote device to complete a software update.
- APIs that need to scale, such as large-scale mobile applications with millions of users.
- Applications that are generally stateless, such as mobile applications or web-based, single-page apps.
- Asynchronous follow up tasks, such as notifying downstream services of an event or responding to a change elsewhere in the system.
Downsides to serverless
- You can get locked into a particular vendor or technology.
- Depending on tech and architecture, it could be expensive at scale.
- Requires up-front planning and strategy to ensure a coherent system design.
- Not appropriate for long-running processes, such as data loads or transformations.
- Resources are usually very limited in serverless implementations (low memory, limited CPU time, little-to-no disk).
- Limited in environment to the options provided by vendor.
Getting started with serverless computing
Pick a small task and build a Lambda function to complete it. Consider the next piece of code you’re going to refactor: Can it be broken out in a reasonable amount of time? If yes, then try your hand at moving it to a Lambda.