Loading...
Loading...
Identifies performance bottlenecks and provides ordered scaling strategies with triggers, phased plans, and cost implications. Use for "scalability planning", "performance bottlenecks", "capacity planning", or "growth strategy".
npx skill4agent add patricio0312rev/skills scalability-playbookTraffic: 1,000 req/min
Users: 10,000 active
Data: 100GB database
Response time: p95 = 500msCREATE INDEX idx_users_email ON users(email);
CREATE INDEX idx_orders_user_created ON orders(user_id, created_at);const cached = await redis.get(`user:${userId}`);
if (cached) return JSON.parse(cached);
const user = await db.users.findById(userId);
await redis.setex(`user:${userId}`, 3600, JSON.stringify(user));Write Load: Primary DB
Read Load: 3x Read ReplicasALB
├── Server 1
├── Server 2
└── Server 3// Before: Sync
await sendEmail(user);
await processPayment(order);
await updateAnalytics(event);
return response; // Waits 5+ seconds
// After: Async
await queue.add("send-email", { userId });
await queue.add("process-payment", { orderId });
await queue.add("update-analytics", { event });
return response; // Returns immediatelyShard 1: user_id 0-24999
Shard 2: user_id 25000-49999
Shard 3: user_id 50000-74999
Shard 4: user_id 75000-99999Service A → Kafka → Service B
↘ ↗ Service C| Metric | Current | Warning | Critical | Action |
| ---------------- | ------- | ------- | -------- | ----------------------- |
| CPU | 40% | 70% | 85% | Add servers |
| Memory | 50% | 75% | 90% | Upgrade instances |
| DB Connections | 20 | 40 | 50 | Add read replicas |
| Query Time (p95) | 200ms | 500ms | 1000ms | Add indexes |
| Queue Depth | 100 | 1000 | 5000 | Add workers |
| Error Rate | 0.1% | 1% | 5% | Investigate immediately |# Current baseline
hey -n 10000 -c 100 https://api.example.com/users
# Target 10x
hey -n 100000 -c 1000 https://api.example.com/users
# Measure:
# - Requests/sec
# - p50, p95, p99 latency
# - Error rate
# - Resource utilization| Strategy | Cost/Month | Expected Impact | ROI | Priority |
| ------------- | ---------- | ------------------ | --- | -------- |
| DB Indexes | $0 | 80% faster queries | ∞ | HIGH |
| Redis Cache | $50 | 60% less DB load | 12x | HIGH |
| Read Replicas | $300 | 3x capacity | 10x | MEDIUM |
| Load Balancer | $400 | 3x throughput | 7x | MEDIUM |
| DB Sharding | $1,200 | 4x capacity | 3x | LOW |