Implement FireCrawl load testing, auto-scaling, and capacity planning strategies. Use when running performance tests, configuring horizontal scaling, or planning capacity for FireCrawl integrations. Trigger with phrases like "firecrawl load test", "firecrawl scale", "firecrawl performance test", "firecrawl capacity", "firecrawl k6", "firecrawl benchmark".
Load testing, scaling strategies, and capacity planning for FireCrawl integrations.
// firecrawl-load-test.js
import http from 'k6/http';
import { check, sleep } from 'k6';
export const options = {
stages: [
{ duration: '2m', target: 10 }, // Ramp up
{ duration: '5m', target: 10 }, // Steady state
{ duration: '2m', target: 50 }, // Ramp to peak
{ duration: '5m', target: 50 }, // Stress test
{ duration: '2m', target: 0 }, // Ramp down
],
thresholds: {
http_req_duration: ['p(95)<500'], # HTTP 500 Internal Server Error
http_req_failed: ['rate<0.01'],
},
};
export default function () {
const response = http.post(
'https://api.firecrawl.com/v1/resource',
JSON.stringify({ test: true }),
{
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${__ENV.FIRECRAWL_API_KEY}`,
},
}
);
check(response, {
'status is 200': (r) => r.status === 200, # HTTP 200 OK
'latency < 500ms': (r) => r.timings.duration < 500, # HTTP 500 Internal Server Error
});
sleep(1);
}
# Install k6
brew install k6 # macOS
# or: sudo apt install k6 # Linux
# Run test
k6 run --env FIRECRAWL_API_KEY=${FIRECRAWL_API_KEY} firecrawl-load-test.js
# Run with output to InfluxDB
k6 run --out influxdb=http://localhost:8086/k6 firecrawl-load-test.js # 8086 = configured value
# kubernetes HPA
apiVersion: autoscaling/v2