1 line
5.5 KiB
JSON
1 line
5.5 KiB
JSON
{"content": "---\nallowed-tools: Read, Bash, Grep, Glob\nargument-hint: [api-type] | --rest | --graphql | --grpc\ndescription: Comprehensive API performance optimization with response time reduction, throughput improvement, and scalability enhancements\n---\n\n# Optimize API Performance\n\nAnalyze and optimize API performance for faster response times, higher throughput, and better scalability: **$ARGUMENTS**\n\n## Instructions\n\n1. **API Performance Analysis**\n - Analyze current API response times and throughput metrics\n - Identify slowest endpoints and bottleneck patterns\n - Profile API request/response lifecycle and processing time\n - Document baseline performance metrics across different load scenarios\n - Map API dependency chains and external service calls\n\n2. **Request/Response Optimization**\n - Optimize request parsing and validation logic\n - Implement efficient response serialization and compression\n - Minimize payload sizes through selective field inclusion\n - Configure appropriate HTTP headers and caching directives\n - Optimize request routing and middleware processing\n\n3. **Database Query Optimization**\n - Identify and optimize slow database queries\n - Implement query result caching strategies\n - Add appropriate database indexes for API queries\n - Optimize database connection pooling and management\n - Implement query batching and aggregation where applicable\n\n4. **Caching Strategy Implementation**\n - Implement multi-level caching (in-memory, Redis, CDN)\n - Configure cache invalidation strategies\n - Set up API response caching with appropriate TTL values\n - Implement cache warming and preloading strategies\n - Monitor cache hit ratios and effectiveness\n\n5. **Rate Limiting and Throttling**\n - Implement intelligent rate limiting based on usage patterns\n - Configure adaptive throttling for different user tiers\n - Set up queue management for handling traffic spikes\n - Implement circuit breaker patterns for external services\n - Monitor and adjust rate limits based on performance metrics\n\n6. **Concurrency and Parallelization**\n - Implement proper async/await patterns for I/O operations\n - Optimize thread pool configuration and management\n - Implement parallel processing for independent operations\n - Configure connection pooling for optimal concurrency\n - Use streaming for large data transfers\n\n7. **API Gateway and Load Balancing**\n - Configure API gateway for optimal routing and load distribution\n - Implement health checks and automatic failover\n - Set up load balancing algorithms for even traffic distribution\n - Configure request/response transformation at gateway level\n - Implement API versioning and traffic splitting\n\n8. **Monitoring and Observability**\n - Set up comprehensive API performance monitoring\n - Implement distributed tracing for request lifecycle visibility\n - Configure performance metrics collection and alerting\n - Monitor API error rates and response time percentiles\n - Set up real-time performance dashboards\n\n9. **Security Performance Optimization**\n - Optimize authentication and authorization processes\n - Implement efficient JWT validation and caching\n - Configure SSL/TLS termination for optimal performance\n - Optimize API key validation and rate limiting\n - Implement security middleware performance tuning\n\n10. **Content Delivery Optimization**\n - Configure CDN for static API responses and assets\n - Implement geographic load balancing and edge caching\n - Optimize API endpoint geographical distribution\n - Set up content compression and optimization\n - Configure cache headers for optimal CDN performance\n\n11. **API Design Optimization**\n - Review and optimize API endpoint design patterns\n - Implement efficient pagination and filtering strategies\n - Optimize API versioning and backward compatibility\n - Design APIs for optimal client-side caching\n - Implement GraphQL query optimization (if applicable)\n\n12. **Load Testing and Performance Validation**\n - Implement comprehensive load testing scenarios\n - Configure performance regression testing in CI/CD\n - Set up chaos engineering tests for resilience validation\n - Monitor API performance under various load conditions\n - Validate performance optimizations with realistic test data\n\n13. **Scalability Planning**\n - Design API architecture for horizontal scaling\n - Implement auto-scaling policies based on performance metrics\n - Configure database scaling strategies (read replicas, sharding)\n - Plan for traffic growth and capacity requirements\n - Implement graceful degradation strategies\n\n14. **Third-Party Service Optimization**\n - Optimize external API calls and integrations\n - Implement retry policies and exponential backoff\n - Configure timeout settings for external services\n - Set up fallback mechanisms for service unavailability\n - Monitor third-party service performance impact\n\n15. **Performance Testing Automation**\n - Set up automated performance testing pipelines\n - Configure performance benchmarking and comparison\n - Implement performance regression detection\n - Set up load testing in staging environments\n - Create performance test data management strategies\n\nFocus on optimizations that provide the highest impact on response times and throughput. Prioritize changes that improve user experience and system scalability while maintaining reliability."} |