# Quota Optimization Plan

## Current Quota Status

### vCPU Quota
- **Total Limit**: 10 vCPUs
- **Currently Used**: 6 vCPUs (3 nodes × Standard_D2s_v3 @ 2 vCPUs each)
- **Available**: 4 vCPUs

## Optimization Strategy

### Option 1: Use 1 vCPU VMs (Recommended)
**VM Size**: `Standard_B1ms` (1 vCPU, 2GB RAM)

**Configuration**:
- System: 1 node × 1 vCPU = 1 vCPU
- Validators: 2 nodes × 1 vCPU = 2 vCPUs
- Sentries: 1 node × 1 vCPU = 1 vCPU
- RPC: 1 node × 1 vCPU = 1 vCPU
- **Total New**: 5 vCPUs
- **Current**: 6 vCPUs
- **Combined**: 11 vCPUs (exceeds quota by 1)

**Solution**: Reduce system pool or keep existing and add only validators

### Option 2: Keep Existing + Add Minimal (Best Fit)
**Keep**: 3 nodes × Standard_D2s_v3 = 6 vCPUs
**Add**: 2 validators × Standard_B1ms = 2 vCPUs
**Total**: 8 vCPUs (within 10 vCPU limit)

### Option 3: Replace with Smaller VMs
**Replace**: 3 × Standard_D2s_v3 (6 vCPUs) with 3 × Standard_B1ms (3 vCPUs)
**Add**: 2 validators × Standard_B1ms (2 vCPUs)
**Total**: 5 vCPUs (well within limit, saves 5 vCPUs)

## Recommended Approach

### Phase 1: Add Validators Only (Fits Current Quota)
```hcl
node_count = {
  system     = 3  # Keep existing
  validators = 2  # Add 2 × 1 vCPU = 2 vCPUs (fits in 4 available)
  sentries   = 0  # Defer
  rpc        = 0  # Defer
}

vm_size = {
  system     = "Standard_D2s_v3"  # Keep existing
  validators = "Standard_B1ms"     # 1 vCPU, 2GB RAM
  sentries   = "Standard_B1ms"
  rpc        = "Standard_B1ms"
}
```

### Phase 2: After Quota Increase
Add sentries and RPC nodes with larger VMs

## Available VM Sizes (1-2 vCPUs)

### Burstable (B-series) - Best for Cost
- **Standard_B1s**: 1 vCPU, 1GB RAM - $0.0052/hour
- **Standard_B1ms**: 1 vCPU, 2GB RAM - $0.0104/hour
- **Standard_B2s**: 2 vCPUs, 4GB RAM - $0.0208/hour

### General Purpose (D-series)
- **Standard_D2s_v3**: 2 vCPUs, 8GB RAM - $0.096/hour (current)
- **Standard_D1s_v3**: 1 vCPU, 4GB RAM - $0.048/hour

### Memory Optimized
- **Standard_E2s_v3**: 2 vCPUs, 16GB RAM - $0.134/hour

## Cost Comparison

### Current Configuration
- 3 × Standard_D2s_v3 = $0.288/hour = ~$210/month

### Optimized Configuration (Option 3)
- 3 × Standard_B1ms = $0.0312/hour = ~$23/month
- 2 × Standard_B1ms (validators) = $0.0208/hour = ~$15/month
- **Total**: ~$38/month (82% cost savings)

## Implementation Steps

1. **Review quotas**: ✅ Done
2. **Select VM sizes**: Standard_B1ms for new nodes
3. **Update terraform.tfvars**: Use quota-optimized config
4. **Deploy validators first**: 2 nodes × 1 vCPU = 2 vCPUs
5. **Monitor performance**: Ensure B-series burst credits sufficient
6. **Scale up later**: After quota increase or performance validation

## Notes

- **B-series VMs**: Have CPU credits, good for variable workloads
- **Minimum for Besu**: 1 vCPU, 2GB RAM (Standard_B1ms)
- **Production recommendation**: Standard_B2s or larger for validators
- **Current approach**: Use B1ms for development/testing, upgrade later
