Performance Tuning
This guide provides detailed strategies for optimizing Dochia's performance across different environments, from development to production, focusing on throughput, resource usage, and execution time.
Rate Limiting and Throttling
Control the load Dochia places on your API to avoid overwhelming your services.
Request Rate Control
# Limit to 60 requests per minute (1 per second)
dochia test -c api.yml -s https://api.example.com \
--max-requests-per-minute 60
# More aggressive rate limiting for production APIs
dochia test -c api.yml -s https://prod-api.example.com \
--max-requests-per-minute 30
Environment-Specific Strategies
- Development: Higher rates (120-300 RPM) for faster feedback
- Staging: Moderate rates (60-120 RPM) to simulate realistic load
- Production: Conservative rates (30-60 RPM) to avoid service disruption
Timeout Optimization
Configure timeouts based on your API's performance characteristics.
Timeout Configuration
# Fast APIs with good infrastructure
dochia test -c api.yml -s https://api.example.com \
--connection-timeout 2000 \
--read-timeout 5000 \
--write-timeout 3000
# Slower APIs or unstable networks
dochia test -c api.yml -s https://api.example.com \
--connection-timeout 5000 \
--read-timeout 15000 \
--write-timeout 10000
Timeout Guidelines
- Connection timeout: 2-5 seconds for most APIs
- Read timeout: 5-15 seconds depending on endpoint complexity
- Write timeout: 3-10 seconds for request transmission
Memory and Resource Management
Optimize Dochia's resource usage for large test suites.
Controlling Test Scope
# Limit the number of fields tested per request
dochia test -c api.yml -s https://api.example.com \
--max-tested-fields 50
# Limit schema combinations for complex oneOf/anyOf
dochia test -c api.yml -s https://api.example.com \
--max-schema-combinations 10
# Control recursion depth for cyclic references
dochia test -c api.yml -s https://api.example.com \
--self-reference-depth 2
Data Size Management
# Reduce string sizes for faster execution
dochia test -c api.yml -s https://api.example.com \
--large-strings-size 10000
# Limit random headers for performance
dochia test -c api.yml -s https://api.example.com \
--random-headers-count 1000
# Limit fields removed in size-based fuzzing
dochia test -c api.yml -s https://api.example.com \
--max-fields-to-remove 10
Execution Strategies
Choose the right execution approach for your use case.
Targeted Testing
# Focus on critical paths only
dochia test -c api.yml -s https://api.example.com \
--paths "/api/v1/users/*,/api/v1/orders/*"
# Test specific HTTP methods
dochia test -c api.yml -s https://api.example.com \
--http-methods GET,POST
# Run only essential playbooks
dochia test -c api.yml -s https://api.example.com \
--playbooks "VeryLargeStrings,SqlInjection,XSS"
Blackbox Mode for Speed
# Only report 5xx errors, ignore validation failures
dochia test -c api.yml -s https://api.example.com -b
This significantly reduces processing time by skipping detailed analysis of expected 4xx responses.
Performance Monitoring
Track and analyze Dochia's performance to identify bottlenecks.
Execution Statistics
# Basic execution stats
dochia test -c api.yml -s https://api.example.com \
--execution-stats
# Detailed per-request statistics
dochia test -c api.yml -s https://api.example.com \
--detailed-execution-stats
Response Time Monitoring
# Set response time limits (in milliseconds)
dochia test -c api.yml -s https://api.example.com \
--max-response-time 2000
This helps identify slow endpoints that may need optimization.
Environment-Specific Configurations
Development Environment
# Fast feedback, comprehensive testing
dochia test -c api.yml -s http://localhost:8080 \
--max-requests-per-minute 300 \
--connection-timeout 1000 \
--read-timeout 3000 \
--execution-stats
Staging Environment
# Balanced performance and coverage
dochia test -c api.yml -s https://staging-api.example.com \
--max-requests-per-minute 120 \
--connection-timeout 3000 \
--read-timeout 8000 \
--max-tested-fields 100 \
-b
Production Environment
# Conservative, focused testing
dochia test -c api.yml -s https://api.example.com \
--max-requests-per-minute 30 \
--connection-timeout 5000 \
--read-timeout 15000 \
--paths "/health,/api/v1/critical/*" \
--playbooks "HealthCheck,BasicValidation" \
-b
Optimization Checklist
Before Running Tests
- Analyze your API: Understand response times and rate limits
- Choose appropriate scope: Use
--paths,--tags, or--playbooksto focus testing - Set realistic timeouts: Based on your API's performance characteristics
- Configure rate limiting: Respect your API's capacity
During Execution
- Monitor resource usage: Watch CPU, memory, and network usage
- Check execution stats: Use
--execution-statsto identify slow endpoints - Adjust parameters: Fine-tune based on real-time performance
After Testing
- Review performance metrics: Analyze execution statistics
- Identify bottlenecks: Look for consistently slow endpoints
- Optimize for next run: Adjust parameters based on findings
Troubleshooting Performance Issues
Slow Execution
- Reduce scope: Use more specific
--pathsor--tags - Increase timeouts: If seeing timeout errors
- Lower rate limits: If API is throttling requests
- Use blackbox mode: Skip detailed validation with
-b
High Memory Usage
- Limit tested fields: Use
--max-tested-fields - Reduce string sizes: Lower
--large-strings-size - Limit schema combinations: Use
--max-schema-combinations - Decrease recursion depth: Use
--self-reference-depth
Network Issues
- Increase connection timeout: For unstable networks
- Use HTTP/2: Enable with
--http2-prior-knowledgeif supported - Configure proxy: Use
--proxyfor corporate networks
See Also
- Best Practices - General optimization strategies
- Customization - Detailed flag reference
- CI/CD Integration - Performance considerations for automated testing
- Troubleshooting - Common performance issues