Skip to content

Bandwidth Allocation & Egress Pricing Architecture

Vì sao quan trọng trong production

GCP không có "unlimited bandwidth" — có caps + quotas. Hiểu cách bandwidth allocated giúp bạn:

  • Avoid bandwidth bottlenecks — Unexpected rate limiting at peak traffic
  • Cost prediction — Egress charges can rival compute costs
  • Capacity planning — Know when to request quota increases
  • Multi-zone optimization — Route through optimal zone to minimize egress

Internal Model: Bandwidth Capacity Architecture

Per-Zone Egress Quotas

Each GCP zone has defined egress capacity:

us-central1-a zone:
├─ Theoretical capacity: Depends on total # of VMs + instances
├─ Shared capacity: All VMs in zone share egress bandwidth
├─ Per-VM baseline: 1Gbps per VM (soft limit, not hard)
├─ Per-VM peak: Can burst to 10Gbps (if zone capacity allows)

├─ Quota examples:
│  ├─ 10 VMs: ~1-10Gbps total (depends on traffic patterns)
│  ├─ 100 VMs: ~10-100Gbps total
│  └─ 1000+ VMs: 100+ Gbps (dedicated fiber)

└─ Zone-level cap: Hardcap at some total (GCP doesn't publish)
   └─ Usually: Not hit unless extreme scale or burst

Request Quota Increases

Standard quota (default):
├─ Per VM: 1-10Gbps burst
├─ Per zone: Automatic scaling based on # VMs
└─ Billing: Standard egress rates apply

Requesting higher quota:
├─ Use case: High-volume data transfer
├─ Application: Via GCP console quota page
├─ Timeline: 1-3 business days for approval
├─ Approval: Usually automatic for reasonable requests

Example quota increase:
├─ Current: 50 VMs in zone, ~5Gbps used
├─ Need: 500 VMs, expect 50Gbps sustained
├─ Request: "Premium bandwidth quota" to 100Gbps
├─ Result: Approved in 2 days, new zone cap now 100Gbps

Egress Pricing Model

Standard egress (not Cloud CDN/networking services):
├─ First 1GB/month: Free
├─ 1-10TB/month: $0.12/GB (Premium Tier) or $0.04/GB (Standard Tier)
├─ 10-100TB/month: $0.11/GB (Premium) or $0.03/GB (Standard)
└─ 100TB+/month: $0.08/GB (Premium) or $0.02/GB (Standard)

Example costs:
├─ 1TB/month: $0.12 * 1024 = ~$123 (Premium)
├─ 100TB/month: $0.08 * 100 * 1024 = ~$8,192 (Premium)
├─ 10,000TB/month (10PB): Per-TB pricing negotiable with GCP

Ingress (always free):
└─ From internet to GCP: $0.00/GB

Inter-region ingress (within GCP):
├─ Within same continent: $0.01/GB
├─ Cross-continent: $0.02/GB (premium route)
└─ Example: us-central1→eu-west1: $0.02/GB

Cloud CDN egress (special pricing):
├─ Cache hit: $0.085/GB (cheaper than standard)
├─ Cache miss: Standard pricing applies
└─ Break-even: ~70% cache hit rate

Cost Breakdown Example (Large Data Pipeline)

Scenario: Process 100TB raw data, output 50TB results

Machine cost: 50 compute hours @ $0.25/hr = $12.50
Storage cost: 150TB-months @ $0.020/TB = $3.00
Egress cost:
├─ Input: 100TB (inbound) = Free
├─ Output: 50TB @ $0.04/GB (Standard) = $2,048.00
├─ Inter-region transfer: 10TB @ $0.01/GB = $102.40

└─ Total: ~$2,165

Egress-driven cost: 94% of total!
Strategic optimization: Most impactful = reducing egress

Production Architecture Patterns

Pattern 1: Multi-Zone Load Balancing (Bandwidth Optimization)

Goal: Distribute 100Gbps load across 4 zones

Architecture:
├─ Zone A (us-central1-a): 25Gbps load
├─ Zone B (us-central1-b): 25Gbps load
├─ Zone C (us-central1-c): 25Gbps load
└─ Zone D (us-central1-f): 25Gbps load

Benefits:
├─ Each zone: 25Gbps (within typical zone limit)
├─ Total capacity: 100Gbps possible without quota increase
├─ Cost: Single premium egress rate (all from same region)

Implementation:
└─ Use Compute Engine MIG with zone distribution policy

Risks:
├─ Zone A failure: 25Gbps traffic migrates to other zones
├─ Temporary: Might exceed zone capacity (need headroom)
└─ Prevention: Keep zones at 70% capacity max

Pattern 2: Regional CDN Cache (Reduce Egress)

Goal: Serve 50TB/month content, reduce egress cost

Scenario without CDN:
├─ Origin: us-central1 (50TB egress)
├─ Egress cost: 50 * 1024 * $0.04 = $2,048/month

Scenario with Cloud CDN:
├─ Origin: us-central1 (1TB egress = cache misses)
├─ Users: Served from cache (regional PoPs)
├─ Cache hit rate: 95%
├─ Egress: 1TB (misses) @ $0.04/GB + 49TB (hits) @ $0.085/GB
├─ Cost: 1*1024*$0.04 + 49*1024*$0.085 = $4,297/month

Wait, more expensive?
└─ Cloud CDN cost: $0.085/GB vs $0.04/GB (premium CDN cache)
└─ Only worthwhile if: Large geographic distribution + high hit rate

Better: Regional caching (app-level):
├─ Cache in asia-southeast1 for Asia users
├─ Cache in eu-west1 for Europe users
├─ Reduces cross-region egress (cheapest regional cache)
└─ Cost: Only new content egress to caches

Pattern 3: Burst Allowance Strategy

Normal operations: 10Gbps sustained
Peak operations: 50Gbps (5x normal)

Challenge: Zone burst capacity?
├─ Is 50Gbps burst available in zone?
├─ Depends on zone utilization
├─ Can't guarantee burst

Strategy:
├─ Test: Create test surge and measure actual zone throttle
├─ Request: Quota increase if throttled
├─ Implement: Gradual burst (ramp over 5-10 min, not instant)
└─ Fallback: Queue excess traffic to next time window

Implementation:
```bash
# Monitor zone egress
gcloud monitoring read \
  'resource.type="gce_instance" AND metric.type="compute.googleapis.com/instance/network/sent_bytes_count"'

# If seeing throttling: Request quota increase
gcloud compute project-info describe --format='value(quotas)'

## Real-world Failure Scenarios

### Scenario 1: Unexpected Egress Rate Limiting

Symptom: Application suddenly slow at peak (every night at 8PM)

Root cause: ├─ New feature added: More data exported at peak time ├─ New egress: Zone hitting capacity limit ├─ Throttling: GCP limits bandwidth to protect zone

Investigation: ├─ Check: Monitoring shows 100% zone egress utilization ├─ Correlation: Starts when data export job begins ├─ Pattern: Repeats every day at same time

Solution: ├─ Short-term: Spread export job across different times ├─ Medium-term: Reduce data size exported (filter at source) ├─ Long-term: Request zone egress quota increase

Prevention: └─ Monitor egress %utilization as KPI └─ Alert when >70% utilization


### Scenario 2: Cost Surprise (Egress Accumulation)

Expectation: $100/month egress costs Reality: $10,000/month egress costs (100x!)

Root cause: ├─ New backup policy: Daily 1TB backups to Cloud Storage ├─ Policy mistake: Replicating across regions (2x egress) ├─ Retention: Keeping 1-year backups (365TB stored) ├─ Egress calculation: │ ├─ Backup: 1TB/day = 30TB/month │ ├─ Replication: 30TB * 2 (cross-region) = 60TB egress │ ├─ Retrieval test: Occasional test restores = 10TB │ └─ Total: ~70TB * $0.12/GB = $8,960

Resolution: ├─ Immediate: Disable cross-region replication (backup only) ├─ Policy: Keep 90-day retention (not 1-year) ├─ Review: All backup/replication policies for egress costs

Cost optimization: └─ Use same-region backups (no egress charge) └─ Use Cloud Storage class transitions (older → coldline)


### Scenario 3: Zone Hotspot (Unbalanced Load)

Deployment: 3 zones, expected equal distribution

Reality: ├─ Zone A: 20Gbps (leader assignment) ├─ Zone B: 15Gbps ├─ Zone C: 5Gbps (total 40Gbps)

Root cause: ├─ Leader election: Zone A elected as leader ├─ All writes route: Through Zone A (egress bottleneck) ├─ Replication: Zone A→B, Zone A→C └─ Result: Zone A sees 2x egress (leader + replication)

Symptoms: ├─ Zone A throttling first ├─ Other zones idle (capacity wasted) ├─ Latency spike only for Zone A traffic

Solution: ├─ Distribute leadership: 3-replica leader election (leader changes) ├─ Load balance: Even shard distribution across zones ├─ Monitor: Per-zone egress metrics (not just total)


## Common Mistakes & Anti-Patterns

### Mistake 1: Assuming Unlimited Burst

❌ **Wrong thinking**:

"Can burst to 10x normal traffic without planning"


✅ **Correct understanding**:
- Zone has total capacity (not infinite)
- Burst possible until zone capacity hit
- If all zones bursting: Still limited
- Must request quota increase for sustainable higher capacity

**Prevention**: Test burst in staging. Measure actual zone throttle point.

### Mistake 2: Forgetting Replication Egress

❌ **Wrong thinking**:

"Data replicated internally, no egress charges"


✅ **Correct understanding**:
- Intra-zone replication: No charge
- Cross-zone replication: Same as inter-region ($0.01/GB)
- Cross-region replication: Premium ($0.02/GB)
- Must account: Replication is 2-3x egress multiplier

**Prevention**: Calculate replication egress separately when budgeting.

### Mistake 3: Not Monitoring Egress %Utilization

❌ **Wrong thinking**:

"Egress capacity automatic, no need to monitor"


✅ **Correct understanding**:
- GCP not transparent about zone capacity
- Throttling happens silently (monitoring required to detect)
- Need: Alert when >70-80% utilization
- Decision point: Request quota increase before hitting limit

**Prevention**: Add egress %util metrics to monitoring dashboard.

## GCP-native Implementation Guidance

### Monitoring Bandwidth Utilization

```bash
# View current egress quota for project
gcloud compute project-info describe \
  --format='value(quotas[name=CPUS,usage])'

# Monitor real-time network egress
gcloud monitoring read \
  'resource.type="gce_instance" AND metric.type="compute.googleapis.com/instance/network/sent_bytes_count"' \
  --format='table(value.int_value, resource.labels.instance_id)'

# Create alert for high egress
gcloud alpha monitoring policies create \
  --notification-channels=CHANNEL_ID \
  --alert-strategy='threshold: 80% of zone_quota, comparison: GREATER'

# Estimate costs
gcloud compute project-info describe --format='value(quotas)'
# Calculate: total_egress_GB * $0.04 or $0.12 per GB

Requesting Quota Increase

bash
# View quota page to request
# https://console.cloud.google.com/iam-admin/quotas

# Or via gcloud (create request)
gcloud compute project-info describe \
  --format='value(quotas)' | grep 'INSTANCE_BANDWIDTH'

# Submit request with:
# - Current quota: X Gbps
# - Requested quota: Y Gbps
# - Justification: Expected 500 VMs in production
# - Timeline: Needed by [date]

# Typical approval: 1-3 business days

Cost Estimation

bash
# Estimate monthly egress cost
EGRESS_GB=$((50 * 1024))  # 50TB/month
TIER="premium"  # $0.12 vs $0.04 for standard

if [ "$TIER" = "premium" ]; then
  COST=$(echo "$EGRESS_GB * 0.12" | bc)
else
  COST=$(echo "$EGRESS_GB * 0.04" | bc)
fi

echo "Estimated monthly cost: \$$COST"

# For 50TB Premium Tier: ~$6,144/month

References


Next: Regional vs Global Services - Data Sovereignty — Architectural implications