1. Performance Hotspots in POD
- Image-heavy traffic (mockups, previews, thumbnails)
- Search/filter large catalog
- Burst traffic by campaign/season
- Background jobs: rendering, AI, sync channel
2. CDN Strategy
Origin (S3/Object Storage)
-> CDN Edge Cache
-> Image transformation layer (WebP/AVIF, resize)
-> Browser cache
| Asset type | TTL | Cache keys |
|---|---|---|
| Immutable mockups | 30-90 days | hash-based URLs |
| PDP images | 7 days | productId+variant+size |
| Editor assets | 1-24h | user scope |
3. Multi-layer Caching
L1: CDN edge
L2: API cache (Redis)
L3: Application in-memory cache
L4: DB query cache/materialized views
class ProductReadCache {
async get(productId: string) {
const key = `pdp:${productId}`;
const cached = await redis.get(key);
if (cached) return JSON.parse(cached);
const value = await this.repo.getPdpView(productId);
await redis.set(key, JSON.stringify(value), 'EX', 300);
return value;
}
}
4. Queue Architecture
Queues
- q.realtime.preview (high priority)
- q.print.production (high priority)
- q.mockup.batch (medium)
- q.channel.sync (medium)
- q.analytics.enrichment (low)
Use dead-letter queues per domain.
interface QueuePolicy {
maxRetry: number;
backoffMs: number[];
timeoutMs: number;
concurrency: number;
}
5. Database Scaling
- Read replicas for product/search reads
- Partitioning follows `shop_id` or `created_at` with big board
- Connection pooling (PgBouncer)
- Index strategy according to query patterns
6. Auto-scaling Policies
| Workload | Scale trigger | Range |
|---|---|---|
| API pods | CPU + P95 latency | 4-60 |
| Queue workers | Queue depth + lag | 2-200 |
| GPU inference | Requests/sec + VRAM | 1-20 |
7. Recommended SLO
- P95 PDP API latency < 250ms
- P95 checkout API latency < 400ms
- Image first byte (CDN) < 100ms
- Queue lag (critical) < 30s
8. Summary
CDN + image optimization is the biggest performance lever for POD
Queue priority Helps protect critical workflows during high loads
DB scaling need to go with query/index discipline
SLO-driven autoscaling Helps balance costs and service quality