Learning Notes #62 β Serverless β Just like riding a taxi
19 January 2025 at 04:55
What is Serverless Computing?
Serverless computing allows developers to run applications without having to manage the underlying infrastructure. You write code, deploy it, and the cloud provider takes care of the rest from provisioning servers to scaling applications.
Popular serverless platforms include AWS Lambda, Azure Functions, and Google Cloud Functions.
The Taxi Analogy
Imagine traveling to a destination. There are multiple ways to get there,
- Owning a Car (Traditional Servers): You own and maintain your car. This means handling maintenance, fuel, insurance, parking, and everything else that comes with it. Itβs reliable and gives you control, but itβs also time-consuming and expensive to manage.
- Hiring a Taxi (Serverless): With a taxi, you simply book a ride when you need it. You donβt worry about maintaining the car, fueling it, or where itβs parked afterward. You pay only for the distance traveled, and the service scales to your needs whether youβre alone or with friends.
Why Serverless is Like Taking a Taxi ?
- No Infrastructure Management β With serverless, you donβt have to manage or worry about servers, just like you donβt need to maintain a taxi.
- Pay-As-You-Go β In a taxi, you pay only for the distance traveled. Similarly, in serverless, youβre billed only for the compute time your application consumes.
- On-Demand Availability β Need a ride at midnight? A taxi is just a booking away. Serverless functions work the same way available whenever you need them, scaling up or down as required.
- Scalability β Whether youβre a solo traveler or part of a group, taxis can adapt by providing a small car or a larger vehicle. Serverless computing scales resources automatically based on traffic, ensuring optimal performance.
- Focus on the Destination β When you take a taxi, you focus on reaching your destination without worrying about the vehicle. Serverless lets you concentrate on writing and deploying code rather than worrying about servers.
Key Benefits of Serverless (and Taxi Rides)
- Cost-Effectiveness β Avoid upfront costs. No need to buy servers (or cars) you might not fully utilize.
- Flexibility β Serverless platforms support multiple programming languages and integrations.
Taxis, too, come in various forms: regular cars, SUVs, and even luxury rides for special occasions. - Reduced Overhead β Free yourself from maintenance tasks, whether itβs patching servers or checking tire pressure.
When Not to Choose Serverless (or a Taxi)
- Predictable, High-Volume Usage β Owning a car might be cheaper if youβre constantly on the road. Similarly, for predictable and sustained workloads, traditional servers or containers might be more cost-effective than serverless.
- Special Requirements β Need a specific type of vehicle, like a truck for moving furniture? Owning one might make sense. Similarly, applications with unique infrastructure requirements may not be a perfect fit for serverless.
- Latency Sensitivity β Taxis take time to arrive after booking. Likewise, serverless functions may experience cold starts, adding slight delays. For ultra-low-latency applications, other architectures may be preferable.