技能 编程开发 Clay 负载扩展

Clay 负载扩展

v20260311
clay-load-scale
Clay 负载测试与扩展指南,涵盖 k6 压测、Kubernetes HPA 自动扩缩、连接池优化和容量计划,帮助验证 Clay 集成的性能与伸缩性。
获取技能
399 次下载
概览

Clay Load & Scale

Overview

Load testing, scaling strategies, and capacity planning for Clay integrations.

Prerequisites

  • k6 load testing tool installed
  • Kubernetes cluster with HPA configured
  • Prometheus for metrics collection
  • Test environment API keys

Capacity Metrics

Metric Warning Critical
CPU Utilization > 70% > 85%
Memory Usage > 75% > 90%
Request Queue Depth > 100 > 500
Error Rate > 1% > 5%
P95 Latency > 1000ms > 3000ms

Instructions

Step 1: Create Load Test Script

Write a k6 test with ramp-up (2m to 10 VUs), steady state (5m), stress (2m to 50 VUs), and ramp-down stages. Set thresholds: P95 < 500ms, error rate < 1%.

Step 2: Configure Auto-Scaling

Set up Kubernetes HPA targeting 70% CPU utilization, 2-20 replicas, with custom metric on queue depth.

Step 3: Implement Connection Pooling

Use generic-pool with 5-20 connections and 30s idle timeout to reuse Clay client connections.

Step 4: Run Load Test and Analyze

k6 run --env CLAY_API_KEY=${CLAY_API_KEY} clay-load-test.js

Record results in the benchmark template: total requests, success rate, P50/P95/P99 latency, max RPS.

For complete k6 scripts, HPA YAML, connection pool code, and capacity estimator, load the reference guide: Read(${CLAUDE_SKILL_DIR}/references/implementation-guide.md)

Output

  • Load test script created
  • HPA configured
  • Benchmark results documented
  • Capacity recommendations defined

Error Handling

Issue Cause Solution
k6 timeout Rate limited Reduce RPS
HPA not scaling Wrong metrics Verify metric name
Connection refused Pool exhausted Increase pool size
Inconsistent results Warm-up needed Add ramp-up phase

Resources

Next Steps

For reliability patterns, see clay-reliability-patterns.

Examples

Basic usage: Apply clay load scale to a standard project setup with default configuration options.

Advanced scenario: Customize clay load scale for production environments with multiple constraints and team-specific requirements.

信息
Category 编程开发
Name clay-load-scale
版本 v20260311
大小 3.14KB
更新时间 2026-03-12
语言