Cost Framework: Serverless vs. Continuously Running Docker Apps
Mohammud Saleem Eshan Jilanee Thupsee
Living Sustainaibly - Have achieved 60% carbon objectives since 2 years on an individual basis and working towards higher levels personally and public
This framework provides a structured approach to evaluate the costs of serverless applications (e.g., Google Cloud Run) compared to continuously running Docker applications. The analysis incorporates key cost factors for each model.
1. Serverless Cost Breakdown
Serverless platforms charge based on usage, including compute time, memory allocation, and request count.
Cost Formula:
Total?Cost=(Request?Count×Execution?Time?per?Request)×Cost?per?GB-second+Additional?Costs\text{Total Cost} = (\text{Request Count} \times \text{Execution Time per Request}) \times \text{Cost per GB-second} + \text{Additional Costs}Total?Cost=(Request?Count×Execution?Time?per?Request)×Cost?per?GB-second+Additional?Costs
Example:
For 1 million requests per month, each taking 30 ms with 128 MB memory:
Total?Compute?Time=1,000,000×0.03?seconds=30,000?seconds?(8.33?hours).\text{Total Compute Time} = 1,000,000 \times 0.03 \, \text{seconds} = 30,000 \, \text{seconds (8.33 hours)}.Total?Compute?Time=1,000,000×0.03seconds=30,000seconds?(8.33?hours).Cost=0.125?GB×30,000?seconds×0.0000166667?USD≈USD?0.64/month.\text{Cost} = 0.125 \, \text{GB} \times 30,000 \, \text{seconds} \times 0.0000166667 \, \text{USD} \approx \text{USD 0.64/month}.Cost=0.125GB×30,000seconds×0.0000166667USD≈USD?0.64/month.
2. Docker Cost Breakdown
Continuously running Docker containers incur fixed costs based on the infrastructure they run on, such as virtual machines or cloud instances.
领英推荐
Cost Formula:
Total?Cost=(Instance?Cost?per?Hour×Uptime?Hours)+Additional?Costs\text{Total Cost} = (\text{Instance Cost per Hour} \times \text{Uptime Hours}) + \text{Additional Costs}Total?Cost=(Instance?Cost?per?Hour×Uptime?Hours)+Additional?Costs
Example:
For a small VM with 2 vCPUs and 4 GB RAM at $0.040/hour, running 24/7:
Total?Uptime=24×30?hours=720?hours.\text{Total Uptime} = 24 \times 30 \, \text{hours} = 720 \, \text{hours}.Total?Uptime=24×30hours=720hours.Cost=720?hours×0.040?USD/hour=USD?28.80/month.\text{Cost} = 720 \, \text{hours} \times 0.040 \, \text{USD/hour} = \text{USD 28.80/month}.Cost=720hours×0.040USD/hour=USD?28.80/month.
3. Comparison Summary
4. Framework Implementation Steps
This cost framework ensures an informed decision tailored to workload characteristics and financial constraints. Let me know if you need help applying this to a specific use case!