LeadershipTechnical ManagerSoftware Economics

Session 01 - TCO & ROI Analysis

Total Cost of Ownership (TCO) Breakdown

TCO không chỉ là chi phí development. Nhiều technical decisions trở nên tệ vì chỉ tính initial cost mà quên ongoing costs.

5 Components of TCO

ComponentMô tả% TypicalOften Forgotten
DevelopmentDesign, coding, testing, deployment20-30%Chỉ tính component này
InfrastructureServers, cloud, networking, storage15-25%Scaling costs
MaintenanceBug fixes, updates, security patches25-35%Grows over time
SupportMonitoring, on-call, incident handling10-15%People cost
Opportunity CostWhat else could team be buildingHard to quantifyAlmost always ignored

Key insight: Development chỉ chiếm 20-30% TCO. Phần lớn chi phí nằm ở maintenance và operations sau khi go-live.

TCO Calculation Template

markdown
## TCO Analysis - [Project/System Name]

### Assumptions
- Team size: [X] engineers
- Fully loaded engineer cost: [$/month]
- Timeline: [X] years
- Expected growth: [X%/year]

### Year 1 Costs
| Category | Item | One-time | Monthly | Annual |
|----------|------|----------|---------|--------|
| **Development** | | | | |
| | Design & Architecture | $X | - | $X |
| | Implementation (X person-months) | $X | - | $X |
| | Testing & QA | $X | - | $X |
| | Migration/Data conversion | $X | - | $X |
| **Infrastructure** | | | | |
| | Compute (VMs/Containers) | - | $X | $X |
| | Database (SQL Server/PostgreSQL) | - | $X | $X |
| | Storage & CDN | - | $X | $X |
| | Networking (bandwidth, VPN) | - | $X | $X |
| **Licensing** | | | | |
| | Software licenses | - | $X | $X |
| | Third-party services/APIs | - | $X | $X |
| **Operations** | | | | |
| | Monitoring & alerting tools | - | $X | $X |
| | On-call rotation (X% of engineer time) | - | $X | $X |
| | Security & compliance | - | $X | $X |
| **Training** | | | | |
| | Team ramp-up | $X | - | $X |
| | Documentation | $X | - | $X |

### 3-Year TCO Projection
| Year | Development | Infrastructure | Operations | Licensing | Total |
|------|------------|---------------|------------|-----------|-------|
| Year 1 | $X | $X | $X | $X | $X |
| Year 2 | $X (maintenance) | $X (+growth) | $X | $X | $X |
| Year 3 | $X (maintenance) | $X (+growth) | $X | $X | $X |
| **Total** | | | | | **$X** |

Ví dụ: On-prem vs Azure Cloud (3 năm)

Hạng mụcOn-premiseAzure Cloud
Hardware$50,000$0
Licenses (OS, SQL)$15,000Included
Cloud compute$0$36,000 ($1,000/mo)
IT staff (maintain)$90,000$30,000
Electricity, cooling$12,000$0
DR/Backup$20,000$5,400
Total 3-year$187,000$71,400
ScalabilityCứng, cần mua thêmElastic
Time to market4-6 tuần setup1-2 ngày

On-prem nhìn rẻ khi chỉ tính hardware. Tính đủ staff + opportunity cost thì cloud thường thắng.


ROI Calculation

Formula

ROI = (Net Benefit / Total Cost) × 100%

Net Benefit = Total Benefits - Total Costs
Payback Period = Total Investment / Annual Net Benefit

ROI Analysis Template

markdown
## ROI Analysis - [Initiative Name]

### Investment (Costs)
| Item | Amount |
|------|--------|
| Development cost | $X |
| Infrastructure (year 1) | $X |
| Training | $X |
| Migration downtime | $X |
| **Total Investment** | **$X** |

### Expected Benefits (Annual)
| Benefit | How Measured | Annual Value |
|---------|-------------|-------------|
| Reduced development time | Hours saved x rate | $X |
| Fewer production incidents | Incidents x cost per incident | $X |
| Infrastructure cost reduction | Current - new cost | $X |
| Faster time-to-market | Revenue from earlier launch | $X |
| **Total Annual Benefit** | | **$X** |

### ROI Calculation
- Net Benefit (Year 1): $[benefit] - $[cost] = $X
- ROI: ($X / $[investment]) x 100% = X%
- Payback Period: $[investment] / $[annual benefit] = X months

Ví dụ: ROI cho Cloud Migration

Investment:
  Migration development:     $120,000 (3 engineers x 2 months)
  New infrastructure setup:  $10,000
  Training:                  $15,000
  Total:                     $145,000

Annual Benefits:
  Infrastructure savings:    $48,000/year (on-prem $8k/mo → cloud $4k/mo)
  Reduced ops overhead:      $36,000/year (less manual work → 0.5 FTE saved)
  Faster deployments:        $24,000/year (weekly → daily, faster bug fixes)
  Total:                     $108,000/year

ROI = ($108,000 / $145,000) x 100% = 74.5% (Year 1)
Payback Period = $145,000 / $108,000 = 16 months
Year 2+ ROI = much higher (no migration cost, only infra)

Ví dụ: Migrate Monolith sang Microservices

Chi phí migration:
  4 devs x 12 tháng x $8K/tháng = $384K
  Infrastructure mới: $24K/năm
  Training: $10K
  Total: $418K

Lợi ích/năm:
  Giảm deploy time: save 200h/năm x $50/h = $10K
  Giảm downtime: 99.9% → 99.99% = $50K/năm saved
  Scale team độc lập: +30% velocity = $120K value
  Giảm incident response: save $40K/năm
  Total: $220K/năm

Year 1: Negative (investment year)
Year 2: ($440K - $418K) / $418K = 5.3%
Year 3: ($660K - $418K) / $418K = 57.9%
Payback: ~23 tháng

Reality check: Migration ROI thường negative Year 1. Phải trình bày vision 3-5 năm cho management.


Cloud Cost Models Comparison

On-prem vs IaaS vs PaaS vs Serverless

DimensionOn-PremisesIaaS (VMs)PaaS (App Service)Serverless (Functions)
Ví dụPhysical serversAzure VMs, AWS EC2Azure App Service, AWS Elastic BeanstalkAzure Functions, AWS Lambda
CapExHigh (hardware)NoneNoneNone
OpExLow (after purchase)Medium (always on)MediumLow (pay per use)
ScalingManual, weeksManual/Auto, minutesAuto, minutesAuto, seconds
ManagementEverythingOS + AppApp onlyCode only
Best forRegulated, predictableLift & shift, custom OSWeb apps, APIsEvent-driven, sporadic
Hidden costsCooling, space, staffIdle VMs, egressPremium tier featuresCold start, execution time

Cost Comparison Example (100K requests/day API)

ModelMonthly CostIncludes
On-prem~$2,500*Server depreciation, electricity, admin time
IaaS (2x D4s VMs)~$400Compute, basic monitoring
PaaS (App Service S2)~$200Compute, SSL, scaling, patching
Serverless (Functions)~$50-150Pay per execution, auto-scale

*On-prem: Khi tính đủ TCO (staff, space, hardware refresh cycle)

Decision Matrix

Choose ON-PREM when:
  ✓ Strict data sovereignty requirements
  ✓ Predictable, constant high load
  ✓ Already own hardware with capacity

Choose IaaS when:
  ✓ Need custom OS configuration
  ✓ Migrating existing apps (lift & shift)
  ✓ Specific hardware requirements (GPU)

Choose PaaS when:
  ✓ Standard web apps and APIs
  ✓ Want managed infrastructure
  ✓ Team focus on code, not ops

Choose Serverless when:
  ✓ Event-driven, sporadic workloads
  ✓ Want zero idle cost
  ✓ Rapid prototyping
  ✗ AVOID for: Long-running processes, consistent high load

Cost Estimation Templates

Engineering Effort Estimation Methods

MethodBest ForAccuracy
T-shirt Sizing (S/M/L/XL)Early stage, rough planning±50-100%
Story Points (Fibonacci)Sprint planning±30-50%
3-Point EstimateImportant projects needing confidence range±20-30%
Bottom-up (Task breakdown)Detailed planning, SOW±10-20%

3-Point Estimate Formula

Expected = (Optimistic + 4 x Most Likely + Pessimistic) / 6
Standard Deviation = (Pessimistic - Optimistic) / 6

Example: Feature X
  Optimistic:  2 weeks
  Most Likely: 4 weeks
  Pessimistic: 10 weeks

  Expected = (2 + 4x4 + 10) / 6 = 4.67 weeks
  SD = (10 - 2) / 6 = 1.33 weeks

  → Communicate: "4-6 weeks, most likely 5 weeks"

Azure Cost Estimation Checklist

  • Compute: VM size, App Service plan, Functions
  • Database: Instance size, storage, IOPS, read replicas
  • Storage: Blob tiers (Hot/Cool/Archive), frequency of access
  • Networking: Egress bandwidth, Load Balancer, CDN, VPN
  • Data transfer: Cross-region, internet egress (surprise bills!)
  • Licensing: SQL Server, Windows (Azure Hybrid Benefit?)
  • Support plan: Basic/Developer/Standard/Professional
  • Reserved Instances: 1-year vs 3-year discount
  • Dev/Test environments: Reduced pricing for non-prod
  • Growth factor: Add 20-30% buffer

Presenting Cost Analysis to Management

Presentation Structure

1. Executive Summary (1 slide)
   → "Đầu tư $X, tiết kiệm $Y/năm, ROI X%, hoàn vốn X tháng"

2. Problem Statement (1 slide)
   → Current cost pain point với data

3. Options Comparison (1 slide)
   → Table so sánh 3 options (do nothing, option A, option B)

4. Recommended Option Detail (1-2 slides)
   → TCO breakdown, timeline, risks

5. Ask (1 slide)
   → Budget needed, decision deadline, next steps

Tips trình bày cost cho management

DoDon't
Dùng annual costs (dễ so sánh budget)Monthly costs (nghe nhỏ, gây misleading)
Show 3-year TCO (capture maintenance growth)Chỉ show Year 1
Include "do nothing" cost (status quo isn't free)Chỉ show cost of change
Sensitivity analysis (what if traffic 2x?)Single point estimate
Round numbers ($150K, không phải $148,752.33)Quá precise → false confidence
Show options (cheap/balanced/premium)Chỉ 1 option, take-it-or-leave-it

Trade-offs Table

DecisionLow CostHigh CostKhi nào chọn High Cost
Build vs BuyBuild (long-term)Buy (short-term)Time-to-market critical
Cloud providerSingle cloudMulti-cloudAvoid vendor lock-in
Team sizeSmall + seniorLarge + mixedScale nhanh
Tech stackProven/boringCutting-edgeCompetitive advantage

Golden rule: Tối ưu chi phí không phải là cắt giảm - mà là đầu tư đúng chỗ.