green and white electric device

Gaziantep’te 220 çalışanlı bir tekstil/ev tekstili e-ticaret markası, son 3 Black Friday’de 2’sinde site çöktü, 1’inde yavaşlık nedeniyle ~~%30 cart abandonment yaşadı. 2025’in Black Friday + Cyber Monday haftasına Azure’a taşıyarak hazırlandık. Sonuç: 12x trafik, sıfır downtime, P95 latency 320ms, 14M TL ciro. Bu yazı o mimarinin notları.

Mimari Genel Bakış

  • Front Door Premium + WAF: Global entry, TR/EU coverage
  • AKS: 3 system node + 6-30 user node (auto-scale)
  • Cosmos DB autoscale: 1.000-50.000 RU/s
  • Azure SQL Hyperscale: Order management
  • Redis Premium: Session + ürün cache
  • Service Bus Premium: Sipariş + ödeme decoupling
  • Storage + CDN: Ürün resim/video
  • Application Insights + Sentinel: Observability + güvenlik

Trafik Tahmini ve Capacity Planning

Dönem RPS (peak) Concurrent user
Normal gün ~~120 ~~3.500
Black Friday başlangıç (00:00) ~~1.450 ~~38.000
Black Friday peak (10:00-12:00) ~~1.820 ~~52.000
Cyber Monday peak ~~1.320 ~~28.000

Tahmin: 12-15x normal trafik. Hazırlık 15x’e göre yapıldı (safety margin).

AKS HPA + Cluster Autoscaler

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: web-frontend-hpa
  namespace: ecom
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: web-frontend
  minReplicas: 6
  maxReplicas: 60
  metrics:
  - type: Resource
    resource:
      name: cpu
      target: { type: Utilization, averageUtilization: 60 }
  - type: Resource
    resource:
      name: memory
      target: { type: Utilization, averageUtilization: 70 }
  - type: Pods
    pods:
      metric: { name: requests_per_second }
      target: { type: AverageValue, averageValue: "100" }
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 30
      policies:
      - type: Percent
        value: 100
        periodSeconds: 30

Cluster Autoscaler 6-30 node arası. Scale-up agresif (30 sn window), scale-down konservatif (5 dk window).

Cosmos DB Autoscale

Provisioned 50K RU/s yerine autoscale 1K-50K. Normal günde 1K, peak’te otomatik 50K. Ödeme: max kullanılan RU/s’in saatlik faturası. Black Friday öncesi pre-warm:

az cosmosdb sql container throughput migrate 
  -g rg-prod -a cosmos-prod -d ecom -n products 
  --throughput-type autoscale

az cosmosdb sql container throughput update 
  -g rg-prod -a cosmos-prod -d ecom -n products 
  --max-throughput 50000

Redis: Cache Strategy

Ürün katalogu (~~85K SKU) Redis’te 4 saat TTL. Sayfa render’ında DB’ye değil Redis’e gidiyor. Cache hit rate Black Friday’de %94.

public async Task<Product> GetProductAsync(string sku)
{
    var cached = await _cache.GetStringAsync($"product:{sku}");
    if (cached != null) return JsonSerializer.Deserialize<Product>(cached);
    
    var product = await _db.Products.FindAsync(sku);
    await _cache.SetStringAsync(
        $"product:{sku}", 
        JsonSerializer.Serialize(product),
        new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(4) });
    return product;
}

Queue-Based Decoupling: Sipariş İşleme

Sipariş alımı senkron yerine async: web sipariş alır → Service Bus’a yazar → return success. Worker queue’dan alır → ödeme + ERP + lojistik.

[Function("ProcessOrder")]
public async Task Run(
    [ServiceBusTrigger("orders", Connection = "SbConn")] OrderMessage msg)
{
    await _payment.ChargeAsync(msg.PaymentInfo);
    await _erp.CreateOrderAsync(msg.Order);
    await _logistics.RequestPickupAsync(msg.Order);
    await _notification.SendOrderConfirmationAsync(msg.Order);
}

Web frontend sipariş alımında 50ms (Service Bus’a yazma süresi). Müşteri “siparişiniz alındı” anında görüyor.

Pre-Black Friday Load Test

Azure Load Testing ile 2 hafta önce stress test:

  • 2.000 RPS, 60.000 concurrent VU, 60 dakika
  • P50 latency: 180ms, P95: 420ms, P99: 850ms
  • Hata oranı: %0.08 (timeout’lar)
  • Bulunanlar: SQL connection pool yetmiyor → pool 50→200; bir API endpoint yavaş → query optimize

Black Friday Sonuçları

Metrik Sonuç
Peak RPS 1.820
P50 latency 120ms
P95 latency 320ms
P99 latency 720ms
Hata oranı %0.04
Toplam sipariş ~~38.500
Toplam ciro 14M TL
Site downtime 0 dk

Maliyet

Black Friday haftası ek maliyet (auto-scale): ~$3.200. Normal aylık $4.800 → o ay $8.000. Karşılığında 14M TL ciro. ROI tartışmasız.

Sahada Düşülen Üç Tuzak

  1. Auto-scale’ı Black Friday günü test etmek: Gerçek event’te scale-up gecikiyor, ilk dakikalar throttling. 2 hafta önce load test şart.
  2. Cache invalidation’ı düşünmemek: Fiyat güncelleme Redis’e yansımayınca müşteri yanlış fiyat görür → şikayet. Event-driven invalidation şart.
  3. Database connection pool’u küçük tutmak: Default 100 yetmez. Load test ile boyutla.

CloudSpark olarak e-ticaret bulut mimarisi, peak event hazırlık (Black Friday, kampanya), AKS auto-scale tasarımı ve load testing projeleri için danışmanlık veriyoruz.

🇹🇷 Türkçe🇬🇧 English🇩🇪 Deutsch🇫🇷 Français🇸🇦 العربية🇷🇺 Русский🇪🇸 Español