cost service: add platform base + per-VIN resource model with CPU/RAM display
- Updated cost model to show: (Platform Base) + (Per-VIN × VINs) - Platform base: 176 cores / 896GB RAM (Kafka, ClickHouse, MongoDB, Redis, PostgreSQL, gateway, monitoring) - Per-VIN marginal: 50mc / 82MB per vehicle - Added RESOURCE USAGE MODEL and COST FORMULA sections to report - Added CPU (mc) and RAM (MB) columns to TOP COST VEHICLES table - Updated README with new report output - virtual-vehicle: documented Vault cert TTL error troubleshooting
This commit is contained in:
@@ -12,60 +12,68 @@ This service estimates the cost of running cloud services per VIN by:
|
||||
|
||||
## Cost Estimation Methodology
|
||||
|
||||
### Resource Estimates Per Active VIN
|
||||
### Cost Model
|
||||
|
||||
| Activity Level | Messages/15min | CPU (cores) | Memory (GB) |
|
||||
|---------------|----------------|-------------|-------------|
|
||||
| Low | < 100 | 0.80 | 1.20 |
|
||||
| Medium | 100-1000 | 1.20 | 1.80 |
|
||||
| High | > 1000 | 1.60 | 2.40 |
|
||||
The cost model separates fixed platform costs from variable per-VIN costs:
|
||||
|
||||
These estimates account for the full data pipeline per vehicle:
|
||||
- Data ingestion (MQTT/HTTP endpoints)
|
||||
- Kafka message processing
|
||||
- Stream processing and transformations
|
||||
- ClickHouse storage and queries
|
||||
- Redis caching
|
||||
- MongoDB document storage
|
||||
- API serving
|
||||
```
|
||||
Total Cost = Platform Base Cost + (Per-VIN Cost × Number of VINs) + Managed Services
|
||||
```
|
||||
|
||||
### Base Infrastructure Costs
|
||||
Whether you have 100 vehicles or 100,000, you still need Kafka, databases, and gateway services running. That's your platform base cost. Then each additional vehicle adds a small marginal cost on top.
|
||||
|
||||
Shared infrastructure costs are distributed across active vehicles each collection interval:
|
||||
### Platform Base Resources (Fixed)
|
||||
|
||||
| Component | Cloud ($/15min) | On-Prem ($/15min) |
|
||||
|-----------|-----------------|-------------------|
|
||||
| Storage, Event Hubs, Defender, monitoring | $10.00 | $0.90 |
|
||||
What it takes to run the cloud services platform:
|
||||
|
||||
### Cost Rates (per hour)
|
||||
| Component | CPU (cores) | Memory (GB) | Notes |
|
||||
|-----------|-------------|-------------|-------|
|
||||
| Kafka brokers | 32 | 128 | 3-node cluster |
|
||||
| ClickHouse | 64 | 256 | 3 shards for HA |
|
||||
| MongoDB | 16 | 128 | Replica set |
|
||||
| Redis | 16 | 128 | Cluster mode |
|
||||
| PostgreSQL | 32 | 128 | Primary + replicas |
|
||||
| Gateway services | 8 | 64 | API gateway, auth |
|
||||
| Monitoring/logging | 8 | 64 | Prometheus, Grafana, Loki |
|
||||
| **Total Platform Base** | **176** | **896** | |
|
||||
|
||||
| Resource | Cloud (Azure) | On-Prem |
|
||||
|----------|---------------|---------|
|
||||
| CPU/core | $0.30 | $0.02 |
|
||||
| Memory/GB| $0.08 | $0.005 |
|
||||
### Per-VIN Resources (Marginal)
|
||||
|
||||
#### Cloud Rates (Fudged Higher)
|
||||
- Based on Azure D-series VM pricing + 50% managed services overhead
|
||||
- Includes: AKS compute, managed Kafka (Event Hubs), CosmosDB, Azure Storage, networking, monitoring
|
||||
- Intentionally conservative (higher) to show true cloud TCO
|
||||
Incremental resources needed for each additional connected vehicle:
|
||||
|
||||
#### On-Prem Rates (Fudged Lower)
|
||||
- Based on 3-year hardware amortization only
|
||||
- Assumes: owned hardware, minimal ops overhead
|
||||
- Intentionally optimistic (lower) to show on-prem savings
|
||||
- Does NOT include: datacenter costs, staff, power, cooling, network, maintenance
|
||||
| Activity Level | Messages/15min | CPU (millicores) | Memory (MB) |
|
||||
|---------------|----------------|------------------|-------------|
|
||||
| Low | < 100 | 50 | 80 |
|
||||
| Medium | 100-1000 | 75 | 120 |
|
||||
| High | > 1000 | 100 | 160 |
|
||||
|
||||
### Cost Rates
|
||||
|
||||
| Resource | Cloud (Azure) | On-Prem/Bare Metal |
|
||||
|----------|---------------|-------------------|
|
||||
| CPU/core-hour | $0.30 | $0.02 |
|
||||
| Memory/GB-hour | $0.08 | $0.005 |
|
||||
| Managed Services/15min | $10.00 | $2.50 |
|
||||
|
||||
#### Why On-Prem is ~90% Cheaper
|
||||
- **Platform base**: Same hardware, but cloud charges ~15x more for managed services
|
||||
- **Per-VIN compute**: Cloud VMs cost ~15x more than amortized bare metal
|
||||
- **Managed services**: Event Hubs, CosmosDB, etc. have significant markup vs self-hosted equivalents
|
||||
|
||||
### Savings Calculation
|
||||
|
||||
```
|
||||
Per-VIN Cost = (CPU_cores × rate + Memory_GB × rate) × hours + (base_infra / active_vins)
|
||||
Cloud Cost = Per-VIN costs summed across fleet
|
||||
On-Prem Cost = Same formula with on-prem rates
|
||||
Platform Base Cost = (176 cores × rate + 896 GB × rate) × hours
|
||||
Per-VIN Cost = (0.05 cores × rate + 0.08 GB × rate) × hours × activity_multiplier
|
||||
Total Cost = Platform Base + (Per-VIN × VIN count) + Managed Services
|
||||
|
||||
Cloud Cost = Total with cloud rates
|
||||
On-Prem Cost = Total with on-prem rates
|
||||
Savings = Cloud Cost - On-Prem Cost
|
||||
Savings % = (Savings / Cloud Cost) × 100
|
||||
```
|
||||
|
||||
Expected savings: **~85-88%** with on-prem hosting (hardware costs only).
|
||||
Expected savings: **~90%** with on-prem/bare metal hosting.
|
||||
|
||||
### Projected Annual Costs (5000 vehicles)
|
||||
|
||||
@@ -114,40 +122,50 @@ curl http://localhost:8077/cost/report
|
||||
╔══════════════════════════════════════════════════════════════════╗
|
||||
║ COST SERVICE REPORT ║
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ Period: 2026-01-03 to 2026-02-03
|
||||
║ Period: 2026-01-05 to 2026-02-05
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ FLEET OVERVIEW ║
|
||||
║ ─────────────────────────────────────────────────────────────── ║
|
||||
║ Active Vehicles: 3143
|
||||
║ Cloud Cost: $5658.12
|
||||
║ On-Prem Cost: $389.98
|
||||
║ Savings: $5268.15 (93.1%)
|
||||
║ Active Vehicles: 3229
|
||||
║ Cloud Cost: $9761.61
|
||||
║ On-Prem Cost: $677.88
|
||||
║ Savings: $9083.73 (93.1%)
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ RESOURCE USAGE MODEL ║
|
||||
║ ─────────────────────────────────────────────────────────────── ║
|
||||
║ Platform Base: 176 cores / 896 GB RAM (fixed)
|
||||
║ Per-VIN Marginal: 50 millicores / 82 MB RAM
|
||||
║ Total Fleet: 337.5 cores / 1154.3 GB RAM
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ COST FORMULA ║
|
||||
║ ─────────────────────────────────────────────────────────────── ║
|
||||
║ (Platform Base) + (Per-VIN × 3229 VINs) + Managed Services
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ COST RATES ║
|
||||
║ ─────────────────────────────────────────────────────────────── ║
|
||||
║ Cloud: CPU $0.30/core-hr Memory $0.080/GB-hr
|
||||
║ On-Prem: CPU $0.02/core-hr Memory $0.005/GB-hr
|
||||
║ Base Infra: Cloud $10.00/15min On-Prem $0.90/15min
|
||||
║ Base Infra: Cloud $10.00/15min On-Prem $2.50/15min
|
||||
╠══════════════════════════════════════════════════════════════════╣
|
||||
║ ANNUAL PROJECTION (based on current usage) ║
|
||||
║ ─────────────────────────────────────────────────────────────── ║
|
||||
║ Cloud Annual: $67897.44
|
||||
║ On-Prem Annual: $4679.70
|
||||
║ Annual Savings: $63217.74
|
||||
║ Cloud Annual: $117139.28
|
||||
║ On-Prem Annual: $8134.50
|
||||
║ Annual Savings: $109004.77
|
||||
╚══════════════════════════════════════════════════════════════════╝
|
||||
|
||||
TOP COST VEHICLES:
|
||||
VIN Cloud $ On-Prem $ Savings %
|
||||
─────────────────── ────────── ────────── ────────
|
||||
VCF1EBU27PG008191 6.84 0.48 93.0%
|
||||
VCF1ZBU28PG005207 6.84 0.48 93.0%
|
||||
VCF1ZBU29PG005488 6.84 0.48 93.0%
|
||||
VCF1ZBU26PG004962 6.76 0.48 93.0%
|
||||
VCF1EBU20PG008145 6.75 0.47 93.0%
|
||||
VIN CPU (mc) RAM (MB) Cloud $ On-Prem $ Savings %
|
||||
─────────────────── ──────── ──────── ────────── ────────── ────────
|
||||
VCF1UBU21PG008884 100 164 14.10 1.04 92.6%
|
||||
VCF1EBU24PG007242 100 164 14.10 1.04 92.6%
|
||||
VCF1ZBU29PG006267 100 164 14.10 1.04 92.6%
|
||||
VCF1EBU26PG007307 75 123 13.41 0.99 92.6%
|
||||
VCF1EBU22PG011967 50 82 12.77 0.93 92.8%
|
||||
...
|
||||
```
|
||||
|
||||
*Note: Report generated 2026-02-03. Costs accumulate over time as the collector runs every 15 minutes.*
|
||||
*Note: Report generated 2026-02-05. Costs accumulate over time as the collector runs every 15 minutes.*
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user