chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [monitoring-type] | --apm | --rum | --custom
|
||||
description: Setup comprehensive application performance monitoring with metrics, alerting, and observability
|
||||
---
|
||||
|
||||
# Add Performance Monitoring
|
||||
|
||||
Setup application performance monitoring: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Performance Monitoring Strategy**
|
||||
- Define key performance indicators (KPIs) and service level objectives (SLOs)
|
||||
- Identify critical user journeys and performance bottlenecks
|
||||
- Plan monitoring architecture and data collection strategy
|
||||
- Assess existing monitoring infrastructure and integration points
|
||||
- Define alerting thresholds and escalation procedures
|
||||
|
||||
2. **Application Performance Monitoring (APM)**
|
||||
- Set up comprehensive APM solution (New Relic, Datadog, AppDynamics)
|
||||
- Configure distributed tracing for request lifecycle visibility
|
||||
- Implement custom metrics and performance tracking
|
||||
- Set up transaction monitoring and error tracking
|
||||
- Configure performance profiling and diagnostics
|
||||
|
||||
3. **Real User Monitoring (RUM)**
|
||||
- Implement client-side performance tracking and web vitals monitoring
|
||||
- Set up user experience metrics collection (LCP, FID, CLS, TTFB)
|
||||
- Configure custom performance metrics for user interactions
|
||||
- Monitor page load performance and resource loading
|
||||
- Track user journey performance across different devices
|
||||
|
||||
4. **Server Performance Monitoring**
|
||||
- Monitor system metrics (CPU, memory, disk, network)
|
||||
- Set up process and application-level monitoring
|
||||
- Configure event loop lag and garbage collection monitoring
|
||||
- Implement custom server performance metrics
|
||||
- Monitor resource utilization and capacity planning
|
||||
|
||||
5. **Database Performance Monitoring**
|
||||
- Track database query performance and slow query identification
|
||||
- Monitor database connection pool utilization
|
||||
- Set up database performance metrics and alerting
|
||||
- Implement query execution plan analysis
|
||||
- Monitor database resource usage and optimization opportunities
|
||||
|
||||
6. **Error Tracking and Monitoring**
|
||||
- Implement comprehensive error tracking (Sentry, Bugsnag, Rollbar)
|
||||
- Configure error categorization and impact analysis
|
||||
- Set up error alerting and notification systems
|
||||
- Track error trends and resolution metrics
|
||||
- Implement error context and debugging information
|
||||
|
||||
7. **Custom Metrics and Dashboards**
|
||||
- Implement business metrics tracking (Prometheus, StatsD)
|
||||
- Create performance dashboards and visualizations
|
||||
- Configure custom alerting rules and thresholds
|
||||
- Set up performance trend analysis and reporting
|
||||
- Implement performance regression detection
|
||||
|
||||
8. **Alerting and Notification System**
|
||||
- Configure intelligent alerting based on performance thresholds
|
||||
- Set up multi-channel notifications (email, Slack, PagerDuty)
|
||||
- Implement alert escalation and on-call procedures
|
||||
- Configure alert fatigue prevention and noise reduction
|
||||
- Set up performance incident management workflows
|
||||
|
||||
9. **Performance Testing Integration**
|
||||
- Integrate monitoring with load testing and performance testing
|
||||
- Set up continuous performance testing and monitoring
|
||||
- Configure performance baseline tracking and comparison
|
||||
- Implement performance test result analysis and reporting
|
||||
- Monitor performance under different load scenarios
|
||||
|
||||
10. **Performance Optimization Recommendations**
|
||||
- Generate actionable performance insights and recommendations
|
||||
- Implement automated performance analysis and reporting
|
||||
- Set up performance optimization tracking and measurement
|
||||
- Configure performance improvement validation
|
||||
- Create performance optimization prioritization frameworks
|
||||
|
||||
Focus on monitoring strategies that provide actionable insights for performance optimization. Ensure monitoring overhead is minimal and doesn't impact application performance.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [cache-type] | --browser | --application | --database
|
||||
description: Design and implement comprehensive caching solutions for improved performance and scalability
|
||||
---
|
||||
|
||||
# Implement Caching Strategy
|
||||
|
||||
Design and implement caching solutions: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Caching Strategy Analysis**
|
||||
- Analyze application architecture and identify caching opportunities
|
||||
- Assess current performance bottlenecks and data access patterns
|
||||
- Define caching requirements (TTL, invalidation, consistency)
|
||||
- Plan multi-layer caching architecture (browser, CDN, application, database)
|
||||
- Evaluate caching technologies and storage solutions
|
||||
|
||||
2. **Browser and Client-Side Caching**
|
||||
- Configure HTTP caching headers and cache policies for static assets
|
||||
- Implement service worker caching strategies for progressive web apps
|
||||
- Set up browser storage caching (localStorage, sessionStorage, IndexedDB)
|
||||
- Configure CDN caching rules and edge optimization
|
||||
- Implement cache-first, network-first, and stale-while-revalidate strategies
|
||||
|
||||
3. **Application-Level Caching**
|
||||
- Implement in-memory caching for frequently accessed data
|
||||
- Set up distributed caching with Redis or Memcached
|
||||
- Design cache key naming conventions and namespacing
|
||||
- Implement cache warming strategies for critical data
|
||||
- Configure cache expiration and TTL policies
|
||||
|
||||
4. **Database Query Caching**
|
||||
- Implement query result caching for expensive database operations
|
||||
- Set up prepared statement caching and connection pooling
|
||||
- Design cache invalidation strategies for data consistency
|
||||
- Implement materialized views for complex aggregations
|
||||
- Configure database-level caching features and optimizations
|
||||
|
||||
5. **API Response Caching**
|
||||
- Implement API endpoint response caching with appropriate headers
|
||||
- Set up middleware for automatic response caching
|
||||
- Configure GraphQL query caching and field-level optimization
|
||||
- Implement conditional requests with ETag and Last-Modified headers
|
||||
- Design cache invalidation for API data updates
|
||||
|
||||
6. **Cache Invalidation Strategies**
|
||||
- Design intelligent cache invalidation based on data dependencies
|
||||
- Implement event-driven cache invalidation systems
|
||||
- Set up cache tagging and bulk invalidation mechanisms
|
||||
- Configure time-based and trigger-based invalidation policies
|
||||
- Implement cache versioning and rollback strategies
|
||||
|
||||
7. **Frontend Caching Strategies**
|
||||
- Implement client-side data caching with libraries like React Query
|
||||
- Set up component-level caching and memoization
|
||||
- Configure asset bundling and chunk caching strategies
|
||||
- Implement progressive image loading and caching
|
||||
- Set up offline-first caching for PWAs
|
||||
|
||||
8. **Cache Monitoring and Analytics**
|
||||
- Set up cache performance monitoring and metrics collection
|
||||
- Track cache hit rates, miss rates, and efficiency metrics
|
||||
- Monitor cache memory usage and storage optimization
|
||||
- Implement cache performance alerting and notifications
|
||||
- Analyze cache usage patterns and optimization opportunities
|
||||
|
||||
9. **Cache Warming and Preloading**
|
||||
- Implement automated cache warming for critical data
|
||||
- Set up scheduled cache refresh and preloading strategies
|
||||
- Design on-demand cache generation for popular content
|
||||
- Configure cache warming triggers based on usage patterns
|
||||
- Implement predictive caching based on user behavior
|
||||
|
||||
10. **Testing and Validation**
|
||||
- Set up cache performance testing and benchmarking
|
||||
- Implement cache consistency validation and testing
|
||||
- Configure cache invalidation testing scenarios
|
||||
- Test cache behavior under high load and failure conditions
|
||||
- Validate cache security and data isolation requirements
|
||||
|
||||
Focus on implementing caching strategies that provide the most significant performance improvements while maintaining data consistency and system reliability. Always measure cache effectiveness and adjust strategies based on real-world usage patterns.
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [api-type] | --rest | --graphql | --grpc
|
||||
description: Comprehensive API performance optimization with response time reduction, throughput improvement, and scalability enhancements
|
||||
---
|
||||
|
||||
# Optimize API Performance
|
||||
|
||||
Analyze and optimize API performance for faster response times, higher throughput, and better scalability: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **API Performance Analysis**
|
||||
- Analyze current API response times and throughput metrics
|
||||
- Identify slowest endpoints and bottleneck patterns
|
||||
- Profile API request/response lifecycle and processing time
|
||||
- Document baseline performance metrics across different load scenarios
|
||||
- Map API dependency chains and external service calls
|
||||
|
||||
2. **Request/Response Optimization**
|
||||
- Optimize request parsing and validation logic
|
||||
- Implement efficient response serialization and compression
|
||||
- Minimize payload sizes through selective field inclusion
|
||||
- Configure appropriate HTTP headers and caching directives
|
||||
- Optimize request routing and middleware processing
|
||||
|
||||
3. **Database Query Optimization**
|
||||
- Identify and optimize slow database queries
|
||||
- Implement query result caching strategies
|
||||
- Add appropriate database indexes for API queries
|
||||
- Optimize database connection pooling and management
|
||||
- Implement query batching and aggregation where applicable
|
||||
|
||||
4. **Caching Strategy Implementation**
|
||||
- Implement multi-level caching (in-memory, Redis, CDN)
|
||||
- Configure cache invalidation strategies
|
||||
- Set up API response caching with appropriate TTL values
|
||||
- Implement cache warming and preloading strategies
|
||||
- Monitor cache hit ratios and effectiveness
|
||||
|
||||
5. **Rate Limiting and Throttling**
|
||||
- Implement intelligent rate limiting based on usage patterns
|
||||
- Configure adaptive throttling for different user tiers
|
||||
- Set up queue management for handling traffic spikes
|
||||
- Implement circuit breaker patterns for external services
|
||||
- Monitor and adjust rate limits based on performance metrics
|
||||
|
||||
6. **Concurrency and Parallelization**
|
||||
- Implement proper async/await patterns for I/O operations
|
||||
- Optimize thread pool configuration and management
|
||||
- Implement parallel processing for independent operations
|
||||
- Configure connection pooling for optimal concurrency
|
||||
- Use streaming for large data transfers
|
||||
|
||||
7. **API Gateway and Load Balancing**
|
||||
- Configure API gateway for optimal routing and load distribution
|
||||
- Implement health checks and automatic failover
|
||||
- Set up load balancing algorithms for even traffic distribution
|
||||
- Configure request/response transformation at gateway level
|
||||
- Implement API versioning and traffic splitting
|
||||
|
||||
8. **Monitoring and Observability**
|
||||
- Set up comprehensive API performance monitoring
|
||||
- Implement distributed tracing for request lifecycle visibility
|
||||
- Configure performance metrics collection and alerting
|
||||
- Monitor API error rates and response time percentiles
|
||||
- Set up real-time performance dashboards
|
||||
|
||||
9. **Security Performance Optimization**
|
||||
- Optimize authentication and authorization processes
|
||||
- Implement efficient JWT validation and caching
|
||||
- Configure SSL/TLS termination for optimal performance
|
||||
- Optimize API key validation and rate limiting
|
||||
- Implement security middleware performance tuning
|
||||
|
||||
10. **Content Delivery Optimization**
|
||||
- Configure CDN for static API responses and assets
|
||||
- Implement geographic load balancing and edge caching
|
||||
- Optimize API endpoint geographical distribution
|
||||
- Set up content compression and optimization
|
||||
- Configure cache headers for optimal CDN performance
|
||||
|
||||
11. **API Design Optimization**
|
||||
- Review and optimize API endpoint design patterns
|
||||
- Implement efficient pagination and filtering strategies
|
||||
- Optimize API versioning and backward compatibility
|
||||
- Design APIs for optimal client-side caching
|
||||
- Implement GraphQL query optimization (if applicable)
|
||||
|
||||
12. **Load Testing and Performance Validation**
|
||||
- Implement comprehensive load testing scenarios
|
||||
- Configure performance regression testing in CI/CD
|
||||
- Set up chaos engineering tests for resilience validation
|
||||
- Monitor API performance under various load conditions
|
||||
- Validate performance optimizations with realistic test data
|
||||
|
||||
13. **Scalability Planning**
|
||||
- Design API architecture for horizontal scaling
|
||||
- Implement auto-scaling policies based on performance metrics
|
||||
- Configure database scaling strategies (read replicas, sharding)
|
||||
- Plan for traffic growth and capacity requirements
|
||||
- Implement graceful degradation strategies
|
||||
|
||||
14. **Third-Party Service Optimization**
|
||||
- Optimize external API calls and integrations
|
||||
- Implement retry policies and exponential backoff
|
||||
- Configure timeout settings for external services
|
||||
- Set up fallback mechanisms for service unavailability
|
||||
- Monitor third-party service performance impact
|
||||
|
||||
15. **Performance Testing Automation**
|
||||
- Set up automated performance testing pipelines
|
||||
- Configure performance benchmarking and comparison
|
||||
- Implement performance regression detection
|
||||
- Set up load testing in staging environments
|
||||
- Create performance test data management strategies
|
||||
|
||||
Focus on optimizations that provide the highest impact on response times and throughput. Prioritize changes that improve user experience and system scalability while maintaining reliability.
|
||||
@@ -0,0 +1,139 @@
|
||||
# Optimize Build Command
|
||||
|
||||
Optimize build processes and speed
|
||||
|
||||
## Instructions
|
||||
|
||||
Follow this systematic approach to optimize build performance: **$ARGUMENTS**
|
||||
|
||||
1. **Build System Analysis**
|
||||
- Identify the build system in use (Webpack, Vite, Rollup, Gradle, Maven, Cargo, etc.)
|
||||
- Review build configuration files and settings
|
||||
- Analyze current build times and output sizes
|
||||
- Map the complete build pipeline and dependencies
|
||||
|
||||
2. **Performance Baseline**
|
||||
- Measure current build times for different scenarios:
|
||||
- Clean build (from scratch)
|
||||
- Incremental build (with cache)
|
||||
- Development vs production builds
|
||||
- Document bundle sizes and asset sizes
|
||||
- Identify the slowest parts of the build process
|
||||
|
||||
3. **Dependency Optimization**
|
||||
- Analyze build dependencies and their impact
|
||||
- Remove unused dependencies from build process
|
||||
- Update build tools to latest stable versions
|
||||
- Consider alternative, faster build tools
|
||||
|
||||
4. **Caching Strategy**
|
||||
- Enable and optimize build caching
|
||||
- Configure persistent cache for CI/CD
|
||||
- Set up shared cache for team development
|
||||
- Implement incremental compilation where possible
|
||||
|
||||
5. **Bundle Analysis**
|
||||
- Analyze bundle composition and sizes
|
||||
- Identify large dependencies and duplicates
|
||||
- Use bundle analyzers specific to your build tool
|
||||
- Look for opportunities to split bundles
|
||||
|
||||
6. **Code Splitting and Lazy Loading**
|
||||
- Implement dynamic imports and code splitting
|
||||
- Set up route-based splitting for SPAs
|
||||
- Configure vendor chunk separation
|
||||
- Optimize chunk sizes and loading strategies
|
||||
|
||||
7. **Asset Optimization**
|
||||
- Optimize images (compression, format conversion, lazy loading)
|
||||
- Minify CSS and JavaScript
|
||||
- Configure tree shaking to remove dead code
|
||||
- Implement asset compression (gzip, brotli)
|
||||
|
||||
8. **Development Build Optimization**
|
||||
- Enable fast refresh/hot reloading
|
||||
- Use development-specific optimizations
|
||||
- Configure source maps for better debugging
|
||||
- Optimize development server settings
|
||||
|
||||
9. **Production Build Optimization**
|
||||
- Enable all production optimizations
|
||||
- Configure dead code elimination
|
||||
- Set up proper minification and compression
|
||||
- Optimize for smaller bundle sizes
|
||||
|
||||
10. **Parallel Processing**
|
||||
- Enable parallel processing where supported
|
||||
- Configure worker threads for build tasks
|
||||
- Optimize for multi-core systems
|
||||
- Use parallel compilation for TypeScript/Babel
|
||||
|
||||
11. **File System Optimization**
|
||||
- Optimize file watching and polling
|
||||
- Configure proper include/exclude patterns
|
||||
- Use efficient file loaders and processors
|
||||
- Minimize file I/O operations
|
||||
|
||||
12. **CI/CD Build Optimization**
|
||||
- Optimize CI build environments and resources
|
||||
- Implement proper caching strategies for CI
|
||||
- Use build matrices efficiently
|
||||
- Configure parallel CI jobs where beneficial
|
||||
|
||||
13. **Memory Usage Optimization**
|
||||
- Monitor and optimize memory usage during builds
|
||||
- Configure heap sizes for build tools
|
||||
- Identify and fix memory leaks in build process
|
||||
- Use memory-efficient compilation options
|
||||
|
||||
14. **Output Optimization**
|
||||
- Configure compression and encoding
|
||||
- Optimize file naming and hashing strategies
|
||||
- Set up proper asset manifests
|
||||
- Implement efficient asset serving
|
||||
|
||||
15. **Monitoring and Profiling**
|
||||
- Set up build time monitoring
|
||||
- Use build profiling tools to identify bottlenecks
|
||||
- Track bundle size changes over time
|
||||
- Monitor build performance regressions
|
||||
|
||||
16. **Tool-Specific Optimizations**
|
||||
|
||||
**For Webpack:**
|
||||
- Configure optimization.splitChunks
|
||||
- Use thread-loader for parallel processing
|
||||
- Enable optimization.usedExports for tree shaking
|
||||
- Configure resolve.modules and resolve.extensions
|
||||
|
||||
**For Vite:**
|
||||
- Configure build.rollupOptions
|
||||
- Use esbuild for faster transpilation
|
||||
- Optimize dependency pre-bundling
|
||||
- Configure build.chunkSizeWarningLimit
|
||||
|
||||
**For TypeScript:**
|
||||
- Use incremental compilation
|
||||
- Configure project references
|
||||
- Optimize tsconfig.json settings
|
||||
- Use skipLibCheck when appropriate
|
||||
|
||||
17. **Environment-Specific Configuration**
|
||||
- Separate development and production configurations
|
||||
- Use environment variables for build optimization
|
||||
- Configure feature flags for conditional builds
|
||||
- Optimize for target environments
|
||||
|
||||
18. **Testing Build Optimizations**
|
||||
- Test build outputs for correctness
|
||||
- Verify all optimizations work in target environments
|
||||
- Check for any breaking changes from optimizations
|
||||
- Measure and document performance improvements
|
||||
|
||||
19. **Documentation and Maintenance**
|
||||
- Document all optimization changes and their impact
|
||||
- Create build performance monitoring dashboard
|
||||
- Set up alerts for build performance regressions
|
||||
- Regular review and updates of build configuration
|
||||
|
||||
Focus on the optimizations that provide the biggest impact for your specific project and team workflow. Always measure before and after to quantify improvements.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [build-tool] | --webpack | --vite | --rollup
|
||||
description: Reduce and optimize bundle sizes through analysis, configuration, and code splitting strategies
|
||||
---
|
||||
|
||||
# Optimize Bundle Size
|
||||
|
||||
Reduce and optimize bundle sizes: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Bundle Analysis and Assessment**
|
||||
- Analyze current bundle size and composition using webpack-bundle-analyzer or similar tools
|
||||
- Identify large dependencies and unused code across all bundles
|
||||
- Assess current build configuration and optimization settings
|
||||
- Create baseline measurements for optimization tracking
|
||||
- Document current performance metrics and loading times
|
||||
|
||||
2. **Build Tool Configuration**
|
||||
- Configure build tool optimization settings for production builds
|
||||
- Enable code splitting and chunk optimization features
|
||||
- Configure tree shaking and dead code elimination
|
||||
- Set up bundle analyzers and visualization tools
|
||||
- Optimize build performance and output sizes
|
||||
|
||||
3. **Code Splitting and Lazy Loading**
|
||||
- Implement route-based code splitting for single-page applications
|
||||
- Set up dynamic imports for components and modules
|
||||
- Configure lazy loading for non-critical resources
|
||||
- Optimize chunk sizes and loading strategies
|
||||
- Implement progressive loading patterns
|
||||
|
||||
4. **Tree Shaking and Dead Code Elimination**
|
||||
- Configure build tools for optimal tree shaking
|
||||
- Mark packages as side-effect free where appropriate
|
||||
- Optimize import statements for better tree shaking
|
||||
- Use ES6 modules and avoid CommonJS where possible
|
||||
- Implement babel plugins for automatic import optimization
|
||||
|
||||
5. **Dependency Optimization**
|
||||
- Analyze and audit package dependencies for size impact
|
||||
- Replace large libraries with smaller alternatives
|
||||
- Use specific imports instead of importing entire libraries
|
||||
- Implement dependency deduplication strategies
|
||||
- Configure external dependencies and CDN usage
|
||||
|
||||
6. **Asset Optimization**
|
||||
- Optimize images through compression and format conversion
|
||||
- Implement responsive image loading strategies
|
||||
- Configure asset minification and compression
|
||||
- Set up efficient file loaders and processors
|
||||
- Optimize font loading and subsetting
|
||||
|
||||
7. **Module Federation and Micro-frontends**
|
||||
- Implement module federation for large applications
|
||||
- Configure shared dependencies and runtime optimization
|
||||
- Set up micro-frontend architecture for code sharing
|
||||
- Optimize remote module loading and caching
|
||||
- Implement federation performance monitoring
|
||||
|
||||
8. **Performance Monitoring and Measurement**
|
||||
- Set up bundle size monitoring and tracking
|
||||
- Configure automated bundle analysis in CI/CD
|
||||
- Monitor bundle size changes over time
|
||||
- Set up performance budgets and alerts
|
||||
- Track loading performance metrics
|
||||
|
||||
9. **Progressive Loading Strategies**
|
||||
- Implement resource hints (preload, prefetch, dns-prefetch)
|
||||
- Configure service workers for caching strategies
|
||||
- Set up intersection observer for lazy loading
|
||||
- Optimize critical resource loading priorities
|
||||
- Implement adaptive loading based on connection speed
|
||||
|
||||
10. **Validation and Continuous Monitoring**
|
||||
- Set up automated bundle size validation in CI/CD
|
||||
- Configure bundle size thresholds and alerts
|
||||
- Implement bundle size regression testing
|
||||
- Monitor real-world loading performance
|
||||
- Set up automated optimization recommendations
|
||||
|
||||
Focus on optimizations that provide the most significant bundle size reductions while maintaining application functionality. Always measure the impact of changes on both bundle size and runtime performance.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [database-type] | --postgresql | --mysql | --mongodb
|
||||
description: Optimize database queries, indexing, and performance for improved response times and scalability
|
||||
---
|
||||
|
||||
# Optimize Database Performance
|
||||
|
||||
Optimize database queries and performance: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Database Performance Analysis**
|
||||
- Analyze current database performance and identify bottlenecks
|
||||
- Review slow query logs and execution plans
|
||||
- Assess database schema design and normalization
|
||||
- Evaluate indexing strategy and query patterns
|
||||
- Monitor database resource utilization (CPU, memory, I/O)
|
||||
|
||||
2. **Query Optimization**
|
||||
- Identify and optimize slow-performing queries
|
||||
- Analyze query execution plans and optimization strategies
|
||||
- Rewrite queries for better performance and efficiency
|
||||
- Implement query hints and optimization directives
|
||||
- Configure query timeout and resource limits
|
||||
|
||||
3. **Index Strategy Optimization**
|
||||
- Analyze existing indexes and their usage patterns
|
||||
- Design optimal indexing strategy for query patterns
|
||||
- Create composite indexes for multi-column queries
|
||||
- Implement covering indexes to avoid table lookups
|
||||
- Remove unused and redundant indexes
|
||||
|
||||
4. **Schema Design Optimization**
|
||||
- Optimize table structure and data types
|
||||
- Implement denormalization strategies for read-heavy workloads
|
||||
- Design partitioning strategies for large tables
|
||||
- Create materialized views for complex aggregations
|
||||
- Optimize foreign key relationships and constraints
|
||||
|
||||
5. **Connection Pool Optimization**
|
||||
- Configure optimal database connection pooling settings
|
||||
- Tune connection pool size and timeout settings
|
||||
- Implement connection monitoring and health checks
|
||||
- Optimize connection lifecycle and cleanup procedures
|
||||
- Configure connection security and SSL settings
|
||||
|
||||
6. **Query Result Caching**
|
||||
- Implement intelligent database result caching
|
||||
- Design cache invalidation strategies for data consistency
|
||||
- Set up query-level and result-set caching
|
||||
- Configure cache expiration and refresh policies
|
||||
- Monitor cache effectiveness and hit rates
|
||||
|
||||
7. **Database Monitoring and Profiling**
|
||||
- Set up comprehensive database performance monitoring
|
||||
- Monitor query performance and resource usage
|
||||
- Track database connections and session activity
|
||||
- Implement alerting for performance degradation
|
||||
- Configure automated performance reporting
|
||||
|
||||
8. **Read Replica and Load Balancing**
|
||||
- Configure read replicas for query distribution
|
||||
- Implement intelligent read/write query routing
|
||||
- Set up load balancing across database instances
|
||||
- Monitor replication lag and consistency
|
||||
- Configure failover and disaster recovery procedures
|
||||
|
||||
9. **Database Vacuum and Maintenance**
|
||||
- Implement automated database maintenance procedures
|
||||
- Configure vacuum and analyze operations for optimal performance
|
||||
- Set up index rebuilding and maintenance schedules
|
||||
- Monitor table bloat and fragmentation
|
||||
- Implement automated cleanup and archival strategies
|
||||
|
||||
10. **Performance Testing and Benchmarking**
|
||||
- Set up database performance testing frameworks
|
||||
- Implement load testing scenarios for realistic workloads
|
||||
- Benchmark query performance under different conditions
|
||||
- Test database scalability and capacity limits
|
||||
- Monitor performance regression and improvements
|
||||
|
||||
Focus on database optimizations that provide the most significant performance improvements for your specific workload patterns. Always measure performance before and after changes to validate optimizations.
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [target-area] | --frontend | --backend | --database
|
||||
description: Comprehensive memory usage optimization with leak detection, garbage collection tuning, and memory profiling
|
||||
---
|
||||
|
||||
# Optimize Memory Usage
|
||||
|
||||
Analyze and optimize memory usage patterns to prevent leaks and improve application performance: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **Memory Analysis and Profiling**
|
||||
- Profile current memory usage patterns using appropriate tools (Chrome DevTools, Node.js --inspect, Valgrind)
|
||||
- Identify memory leaks and excessive memory consumption hotspots
|
||||
- Analyze garbage collection patterns and performance impact
|
||||
- Create baseline measurements for optimization tracking
|
||||
- Document memory allocation hotspots and growth patterns over time
|
||||
|
||||
2. **Memory Leak Detection**
|
||||
- Set up memory leak detection for different runtime environments
|
||||
- Monitor heap snapshots and compare over time intervals
|
||||
- Track DOM node leaks in browser applications
|
||||
- Implement event listener cleanup and monitoring
|
||||
- Use profiling tools to identify growing memory patterns
|
||||
|
||||
3. **Garbage Collection Optimization**
|
||||
- Configure garbage collection settings for your runtime environment
|
||||
- Tune Node.js heap sizes and GC flags for optimal performance
|
||||
- Monitor GC pause times and frequency
|
||||
- Implement GC performance monitoring and alerting
|
||||
- Optimize object lifecycles to reduce GC pressure
|
||||
|
||||
4. **Memory Pool and Object Reuse**
|
||||
- Implement object pooling for frequently allocated objects
|
||||
- Create buffer pools for Node.js applications
|
||||
- Reuse DOM elements and components in frontend applications
|
||||
- Design memory-efficient data structures (circular buffers, sparse arrays)
|
||||
- Pre-allocate objects to reduce runtime allocation overhead
|
||||
|
||||
5. **String and Text Optimization**
|
||||
- Implement string interning for frequently used strings
|
||||
- Optimize string concatenation and manipulation operations
|
||||
- Use efficient text processing algorithms
|
||||
- Minimize string duplication across the application
|
||||
- Consider string compression for large text data
|
||||
|
||||
6. **Database Connection Optimization**
|
||||
- Implement proper connection pooling with appropriate limits
|
||||
- Configure connection timeouts and cleanup procedures
|
||||
- Optimize query result caching and memory usage
|
||||
- Monitor database connection memory overhead
|
||||
- Implement connection leak detection and prevention
|
||||
|
||||
7. **Frontend Memory Optimization**
|
||||
- Optimize component lifecycle and cleanup
|
||||
- Implement proper event listener cleanup
|
||||
- Use lazy loading for images and components
|
||||
- Minimize bundle size and code splitting
|
||||
- Monitor and optimize browser memory usage patterns
|
||||
|
||||
8. **Backend Memory Optimization**
|
||||
- Optimize server request handling and cleanup
|
||||
- Implement streaming for large data processing
|
||||
- Configure appropriate memory limits and monitoring
|
||||
- Optimize middleware and request lifecycle
|
||||
- Use memory-efficient data processing patterns
|
||||
|
||||
9. **Container and Deployment Optimization**
|
||||
- Configure appropriate container memory limits
|
||||
- Optimize Docker image layers for memory efficiency
|
||||
- Monitor memory usage in production environments
|
||||
- Implement memory-based auto-scaling policies
|
||||
- Set up memory usage alerting and monitoring
|
||||
|
||||
10. **Memory Monitoring and Alerting**
|
||||
- Set up real-time memory monitoring dashboards
|
||||
- Configure memory usage alerts and thresholds
|
||||
- Implement memory leak detection in production
|
||||
- Track memory performance metrics over time
|
||||
- Create automated memory optimization testing
|
||||
|
||||
11. **Production Memory Management**
|
||||
- Implement graceful memory pressure handling
|
||||
- Configure memory-based health checks
|
||||
- Set up memory usage trending and analysis
|
||||
- Implement emergency memory cleanup procedures
|
||||
- Monitor and optimize memory usage patterns
|
||||
|
||||
Focus on the specific memory optimization strategies that provide the biggest impact for your target environment. Always measure memory usage before and after optimizations to quantify improvements.
|
||||
@@ -0,0 +1,88 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [target-area] | --frontend | --backend | --full
|
||||
description: Comprehensive performance audit with metrics, bottleneck identification, and optimization recommendations
|
||||
---
|
||||
|
||||
# Performance Audit
|
||||
|
||||
Conduct comprehensive performance audit: $ARGUMENTS
|
||||
|
||||
## Current Performance Context
|
||||
|
||||
- Bundle analysis: !`npm run build -- --analyze 2>/dev/null || echo "No build analyzer"`
|
||||
- Dependencies: !`npm list --depth=0 --prod 2>/dev/null | head -10`
|
||||
- Build time: !`time npm run build >/dev/null 2>&1 || echo "No build script"`
|
||||
- Performance config: @webpack.config.js or @vite.config.js or @next.config.js (if exists)
|
||||
|
||||
## Task
|
||||
|
||||
Conduct comprehensive performance audit following these steps:
|
||||
|
||||
1. **Technology Stack Analysis**
|
||||
- Identify the primary language, framework, and runtime environment
|
||||
- Review build tools and optimization configurations
|
||||
- Check for performance monitoring tools already in place
|
||||
|
||||
2. **Code Performance Analysis**
|
||||
- Identify inefficient algorithms and data structures
|
||||
- Look for nested loops and O(n²) operations
|
||||
- Check for unnecessary computations and redundant operations
|
||||
- Review memory allocation patterns and potential leaks
|
||||
|
||||
3. **Database Performance**
|
||||
- Analyze database queries for efficiency
|
||||
- Check for missing indexes and slow queries
|
||||
- Review connection pooling and database configuration
|
||||
- Identify N+1 query problems and excessive database calls
|
||||
|
||||
4. **Frontend Performance (if applicable)**
|
||||
- Analyze bundle size and chunk optimization
|
||||
- Check for unused code and dependencies
|
||||
- Review image optimization and lazy loading
|
||||
- Examine render performance and re-render cycles
|
||||
- Check for memory leaks in UI components
|
||||
|
||||
5. **Network Performance**
|
||||
- Review API call patterns and caching strategies
|
||||
- Check for unnecessary network requests
|
||||
- Analyze payload sizes and compression
|
||||
- Examine CDN usage and static asset optimization
|
||||
|
||||
6. **Asynchronous Operations**
|
||||
- Review async/await usage and promise handling
|
||||
- Check for blocking operations and race conditions
|
||||
- Analyze task queuing and background processing
|
||||
- Identify opportunities for parallel execution
|
||||
|
||||
7. **Memory Usage**
|
||||
- Check for memory leaks and excessive memory consumption
|
||||
- Review garbage collection patterns
|
||||
- Analyze object lifecycle and cleanup
|
||||
- Identify large objects and unnecessary data retention
|
||||
|
||||
8. **Build & Deployment Performance**
|
||||
- Analyze build times and optimization opportunities
|
||||
- Review dependency bundling and tree shaking
|
||||
- Check for development vs production optimizations
|
||||
- Examine deployment pipeline efficiency
|
||||
|
||||
9. **Performance Monitoring**
|
||||
- Check existing performance metrics and monitoring
|
||||
- Identify key performance indicators (KPIs) to track
|
||||
- Review alerting and performance thresholds
|
||||
- Suggest performance testing strategies
|
||||
|
||||
10. **Benchmarking & Profiling**
|
||||
- Run performance profiling tools appropriate for the stack
|
||||
- Create benchmarks for critical code paths
|
||||
- Measure before and after optimization impact
|
||||
- Document performance baselines
|
||||
|
||||
11. **Optimization Recommendations**
|
||||
- Prioritize optimizations by impact and effort
|
||||
- Provide specific code examples and alternatives
|
||||
- Suggest architectural improvements for scalability
|
||||
- Recommend appropriate performance tools and libraries
|
||||
|
||||
Include specific file paths, line numbers, and measurable metrics where possible. Focus on high-impact, low-effort optimizations first.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
argument-hint: [cdn-provider] | --cloudflare | --aws | --fastly
|
||||
description: Configure CDN for optimal content delivery, caching, and global performance optimization
|
||||
---
|
||||
|
||||
# Setup CDN Optimization
|
||||
|
||||
Configure CDN for optimal delivery: **$ARGUMENTS**
|
||||
|
||||
## Instructions
|
||||
|
||||
1. **CDN Strategy and Provider Selection**
|
||||
- Analyze application traffic patterns and global user distribution
|
||||
- Evaluate CDN providers based on performance, cost, and features
|
||||
- Assess content types and specific caching requirements
|
||||
- Plan CDN architecture and edge location strategy
|
||||
- Define performance and cost optimization goals
|
||||
|
||||
2. **CDN Configuration and Setup**
|
||||
- Configure CDN with optimal settings for your content types
|
||||
- Set up origin servers and failover configurations
|
||||
- Configure SSL/TLS certificates and security settings
|
||||
- Implement custom domain and DNS configuration
|
||||
- Set up monitoring and analytics tracking
|
||||
|
||||
3. **Static Asset Optimization**
|
||||
- Optimize asset build process for CDN delivery
|
||||
- Configure content hashing and versioning strategies
|
||||
- Set up asset bundling and code splitting for CDN
|
||||
- Implement responsive image delivery and optimization
|
||||
- Configure font loading and optimization strategies
|
||||
|
||||
4. **Compression and Optimization**
|
||||
- Configure Gzip and Brotli compression settings
|
||||
- Set up build-time compression for static assets
|
||||
- Implement dynamic compression for API responses
|
||||
- Configure minification and asset optimization
|
||||
- Set up progressive image formats (WebP, AVIF)
|
||||
|
||||
5. **Cache Headers and Policies**
|
||||
- Design intelligent caching strategies for different content types
|
||||
- Configure cache control headers and TTL values
|
||||
- Implement ETags and conditional request handling
|
||||
- Set up cache hierarchy and multi-tier caching
|
||||
- Configure cache warming and preloading strategies
|
||||
|
||||
6. **Image Optimization and Delivery**
|
||||
- Implement responsive image delivery with multiple formats
|
||||
- Set up automatic image compression and optimization
|
||||
- Configure lazy loading and progressive image loading
|
||||
- Implement image resizing and format conversion
|
||||
- Set up WebP and AVIF format support with fallbacks
|
||||
|
||||
7. **CDN Purging and Cache Invalidation**
|
||||
- Implement intelligent cache invalidation strategies
|
||||
- Set up automated purging for deployment pipelines
|
||||
- Configure selective purging by tags or patterns
|
||||
- Implement real-time cache invalidation for dynamic content
|
||||
- Set up cache invalidation monitoring and alerts
|
||||
|
||||
8. **Performance Monitoring and Analytics**
|
||||
- Set up CDN performance monitoring and metrics tracking
|
||||
- Monitor cache hit ratios and bandwidth usage
|
||||
- Track response times and error rates across regions
|
||||
- Implement real user monitoring for CDN performance
|
||||
- Set up alerts for performance degradation
|
||||
|
||||
9. **Security and Access Control**
|
||||
- Configure CDN security headers and policies
|
||||
- Implement hotlink protection and referrer validation
|
||||
- Set up DDoS protection and rate limiting
|
||||
- Configure geo-blocking and access restrictions
|
||||
- Implement secure token authentication for protected content
|
||||
|
||||
10. **Cost Optimization and Monitoring**
|
||||
- Monitor CDN usage and costs across different tiers
|
||||
- Implement cost optimization strategies for bandwidth usage
|
||||
- Set up automated cost alerts and budget monitoring
|
||||
- Analyze usage patterns for tier optimization
|
||||
- Configure cost-effective caching policies
|
||||
|
||||
Focus on CDN optimizations that provide the most significant performance improvements for your specific content types and user base. Always measure CDN performance impact and adjust configurations based on real-world usage patterns.
|
||||
@@ -0,0 +1,415 @@
|
||||
# System Behavior Simulator
|
||||
|
||||
Simulate system performance under various loads with capacity planning, bottleneck identification, and optimization strategies.
|
||||
|
||||
## Instructions
|
||||
|
||||
You are tasked with creating comprehensive system behavior simulations to predict performance, identify bottlenecks, and optimize capacity planning. Follow this approach: **$ARGUMENTS**
|
||||
|
||||
### 1. Prerequisites Assessment
|
||||
|
||||
**Critical System Context Validation:**
|
||||
|
||||
- **System Architecture**: What type of system are you simulating behavior for?
|
||||
- **Performance Goals**: What are the target performance metrics and SLAs?
|
||||
- **Load Characteristics**: What are the expected usage patterns and traffic profiles?
|
||||
- **Resource Constraints**: What infrastructure and budget limitations apply?
|
||||
- **Optimization Objectives**: What aspects of performance are most critical to optimize?
|
||||
|
||||
**If context is unclear, guide systematically:**
|
||||
|
||||
```
|
||||
Missing System Architecture:
|
||||
"What type of system needs behavior simulation?
|
||||
- Web Application: User-facing application with HTTP traffic patterns
|
||||
- API Service: Backend service with programmatic access patterns
|
||||
- Data Processing: Batch or stream processing with throughput requirements
|
||||
- Database System: Data storage and query processing optimization
|
||||
- Microservices: Distributed system with inter-service communication
|
||||
|
||||
Please specify system components, technology stack, and deployment architecture."
|
||||
|
||||
Missing Performance Goals:
|
||||
"What performance objectives need to be met?
|
||||
- Response Time: Target latency for user requests (p50, p95, p99)
|
||||
- Throughput: Requests per second or transactions per minute
|
||||
- Availability: Uptime targets and fault tolerance requirements
|
||||
- Scalability: User growth and load handling capabilities
|
||||
- Resource Efficiency: CPU, memory, storage, and network optimization"
|
||||
```
|
||||
|
||||
### 2. System Architecture Modeling
|
||||
|
||||
**Systematically map system components and interactions:**
|
||||
|
||||
#### Component Architecture Framework
|
||||
```
|
||||
System Component Mapping:
|
||||
|
||||
Application Layer:
|
||||
- Frontend Components: User interfaces, single-page applications, mobile apps
|
||||
- Application Services: Business logic, workflow processing, API endpoints
|
||||
- Background Services: Scheduled jobs, message processing, batch operations
|
||||
- Integration Services: External API calls, webhook handling, data synchronization
|
||||
|
||||
Data Layer:
|
||||
- Primary Databases: Transactional data storage and query processing
|
||||
- Cache Systems: Redis, Memcached, CDN, and application-level caching
|
||||
- Message Queues: Asynchronous communication and event processing
|
||||
- Search Systems: Elasticsearch, Solr, or database search capabilities
|
||||
|
||||
Infrastructure Layer:
|
||||
- Load Balancers: Traffic distribution and health checking
|
||||
- Web Servers: HTTP request handling and static content serving
|
||||
- Application Servers: Dynamic content generation and business logic
|
||||
- Network Components: Firewalls, VPNs, and traffic routing
|
||||
```
|
||||
|
||||
#### Interaction Pattern Modeling
|
||||
```
|
||||
System Interaction Analysis:
|
||||
|
||||
Synchronous Interactions:
|
||||
- Request-Response: Direct API calls and database queries
|
||||
- Service Mesh: Inter-service communication with service discovery
|
||||
- Database Transactions: ACID compliance and locking mechanisms
|
||||
- External API Calls: Third-party service dependencies and timeouts
|
||||
|
||||
Asynchronous Interactions:
|
||||
- Message Queues: Pub/sub patterns and event-driven processing
|
||||
- Event Streams: Real-time data processing and analytics
|
||||
- Background Jobs: Scheduled tasks and delayed processing
|
||||
- Webhooks: External system notifications and callbacks
|
||||
|
||||
Data Flow Patterns:
|
||||
- Read Patterns: Query optimization and caching strategies
|
||||
- Write Patterns: Data ingestion and consistency management
|
||||
- Batch Processing: ETL operations and data pipeline processing
|
||||
- Real-time Processing: Stream processing and live analytics
|
||||
```
|
||||
|
||||
### 3. Load Modeling Framework
|
||||
|
||||
**Create realistic traffic and usage pattern simulations:**
|
||||
|
||||
#### Traffic Pattern Analysis
|
||||
```
|
||||
Load Characteristics Modeling:
|
||||
|
||||
User Behavior Patterns:
|
||||
- Daily Patterns: Peak hours, lunch dips, overnight minimums
|
||||
- Weekly Patterns: Weekday vs weekend usage variations
|
||||
- Seasonal Patterns: Holiday traffic, business cycle fluctuations
|
||||
- Event-Driven Spikes: Marketing campaigns, viral content, news events
|
||||
|
||||
Request Distribution:
|
||||
- Geographic Distribution: Multi-region traffic and latency patterns
|
||||
- Device Distribution: Mobile vs desktop vs API usage patterns
|
||||
- Feature Distribution: Popular vs niche feature usage ratios
|
||||
- User Type Distribution: New vs returning vs power user behaviors
|
||||
|
||||
Load Volume Scaling:
|
||||
- Concurrent Users: Simultaneous active sessions and request patterns
|
||||
- Request Rate: Transactions per second with burst capabilities
|
||||
- Data Volume: Payload sizes and data transfer requirements
|
||||
- Connection Patterns: Session duration and connection pooling
|
||||
```
|
||||
|
||||
#### Synthetic Load Generation
|
||||
```
|
||||
Load Testing Scenario Framework:
|
||||
|
||||
Baseline Load Testing:
|
||||
- Normal Traffic: Typical daily usage patterns and request volumes
|
||||
- Sustained Load: Constant traffic over extended periods
|
||||
- Gradual Ramp: Slow traffic increase to identify scaling points
|
||||
- Steady State: Stable load for performance baseline establishment
|
||||
|
||||
Stress Testing:
|
||||
- Peak Load: Maximum expected traffic during busy periods
|
||||
- Capacity Testing: System limits and breaking point identification
|
||||
- Spike Testing: Sudden traffic increases and recovery behavior
|
||||
- Volume Testing: Large data sets and high-throughput scenarios
|
||||
|
||||
Resilience Testing:
|
||||
- Failure Scenarios: Component outages and degraded service behavior
|
||||
- Recovery Testing: System restoration and performance recovery
|
||||
- Chaos Engineering: Random failure injection and system adaptation
|
||||
- Disaster Simulation: Major outage scenarios and business continuity
|
||||
```
|
||||
|
||||
### 4. Performance Modeling Engine
|
||||
|
||||
**Create comprehensive system performance predictions:**
|
||||
|
||||
#### Performance Metric Framework
|
||||
```
|
||||
Multi-Dimensional Performance Analysis:
|
||||
|
||||
Response Time Metrics:
|
||||
- Request Latency: End-to-end response time measurement
|
||||
- Processing Time: Application logic execution duration
|
||||
- Database Query Time: Data access and retrieval performance
|
||||
- Network Latency: Communication overhead and bandwidth utilization
|
||||
|
||||
Throughput Metrics:
|
||||
- Requests per Second: HTTP request handling capacity
|
||||
- Transactions per Minute: Business operation completion rate
|
||||
- Data Processing Rate: Batch job and stream processing throughput
|
||||
- Concurrent User Capacity: Simultaneous session handling capability
|
||||
|
||||
Resource Utilization Metrics:
|
||||
- CPU Usage: Processing power consumption and efficiency
|
||||
- Memory Usage: RAM allocation and garbage collection impact
|
||||
- Storage I/O: Disk read/write performance and capacity
|
||||
- Network Bandwidth: Data transfer rates and congestion management
|
||||
|
||||
Quality Metrics:
|
||||
- Error Rates: Failed requests and transaction failures
|
||||
- Availability: System uptime and service reliability
|
||||
- Consistency: Data integrity and transaction isolation
|
||||
- Security: Authentication, authorization, and data protection overhead
|
||||
```
|
||||
|
||||
#### Performance Prediction Modeling
|
||||
```
|
||||
Predictive Performance Framework:
|
||||
|
||||
Analytical Models:
|
||||
- Queueing Theory: Wait time and service rate mathematical modeling
|
||||
- Little's Law: Relationship between concurrency, throughput, and latency
|
||||
- Capacity Planning: Resource requirement forecasting and optimization
|
||||
- Bottleneck Analysis: System constraint identification and resolution
|
||||
|
||||
Simulation Models:
|
||||
- Discrete Event Simulation: System behavior modeling with event queues
|
||||
- Monte Carlo Simulation: Probabilistic performance outcome analysis
|
||||
- Load Testing Data: Historical performance pattern extrapolation
|
||||
- Machine Learning: Pattern recognition and predictive analytics
|
||||
|
||||
Hybrid Models:
|
||||
- Analytical + Empirical: Mathematical models calibrated with real data
|
||||
- Multi-Layer Modeling: Component-level models aggregated to system level
|
||||
- Dynamic Adaptation: Models that adjust based on real-time performance
|
||||
- Scenario-Based: Different models for different load and usage patterns
|
||||
```
|
||||
|
||||
### 5. Bottleneck Identification System
|
||||
|
||||
**Systematically identify and analyze performance constraints:**
|
||||
|
||||
#### Bottleneck Detection Framework
|
||||
```
|
||||
Performance Constraint Analysis:
|
||||
|
||||
CPU Bottlenecks:
|
||||
- High CPU Utilization: Processing-intensive operations and algorithms
|
||||
- Thread Contention: Locking and synchronization overhead
|
||||
- Context Switching: Excessive thread creation and management
|
||||
- Inefficient Algorithms: Poor time complexity and optimization opportunities
|
||||
|
||||
Memory Bottlenecks:
|
||||
- Memory Leaks: Gradual memory consumption and garbage collection pressure
|
||||
- Large Object Allocation: Memory-intensive operations and caching strategies
|
||||
- Memory Fragmentation: Allocation patterns and memory pool management
|
||||
- Cache Misses: Application and database cache effectiveness
|
||||
|
||||
I/O Bottlenecks:
|
||||
- Database Performance: Query optimization and index effectiveness
|
||||
- Disk I/O: Storage access patterns and disk performance limits
|
||||
- Network I/O: Bandwidth limitations and latency optimization
|
||||
- External Dependencies: Third-party service response times and reliability
|
||||
|
||||
Application Bottlenecks:
|
||||
- Blocking Operations: Synchronous calls and thread pool exhaustion
|
||||
- Inefficient Code: Poor algorithms and unnecessary processing
|
||||
- Resource Contention: Shared resource access and locking mechanisms
|
||||
- Configuration Issues: Suboptimal settings and parameter tuning
|
||||
```
|
||||
|
||||
#### Root Cause Analysis
|
||||
- Performance profiling and trace analysis
|
||||
- Correlation analysis between metrics and bottlenecks
|
||||
- Historical pattern recognition and trend analysis
|
||||
- Comparative analysis across different system configurations
|
||||
|
||||
### 6. Optimization Strategy Generation
|
||||
|
||||
**Create systematic performance improvement approaches:**
|
||||
|
||||
#### Performance Optimization Framework
|
||||
```
|
||||
Multi-Level Optimization Strategies:
|
||||
|
||||
Code-Level Optimizations:
|
||||
- Algorithm Optimization: Improved time and space complexity
|
||||
- Database Query Optimization: Index usage and query plan improvement
|
||||
- Caching Strategies: Application, database, and CDN caching
|
||||
- Asynchronous Processing: Non-blocking operations and parallelization
|
||||
|
||||
Architecture-Level Optimizations:
|
||||
- Horizontal Scaling: Load distribution across multiple instances
|
||||
- Vertical Scaling: Resource allocation and capacity increases
|
||||
- Caching Layers: Multi-tier caching and cache invalidation strategies
|
||||
- Database Sharding: Data partitioning and distributed storage
|
||||
|
||||
Infrastructure-Level Optimizations:
|
||||
- Auto-Scaling: Dynamic resource allocation based on demand
|
||||
- Load Balancing: Traffic distribution and health checking optimization
|
||||
- CDN Implementation: Geographic content distribution and edge caching
|
||||
- Network Optimization: Bandwidth allocation and latency reduction
|
||||
|
||||
System-Level Optimizations:
|
||||
- Monitoring and Alerting: Performance visibility and proactive issue detection
|
||||
- Capacity Planning: Resource forecasting and growth accommodation
|
||||
- Disaster Recovery: Backup strategies and failover mechanisms
|
||||
- Security Optimization: Performance-aware security implementation
|
||||
```
|
||||
|
||||
#### Cost-Benefit Analysis
|
||||
- Performance improvement quantification and measurement
|
||||
- Infrastructure cost implications and budget optimization
|
||||
- Development effort estimation and resource allocation
|
||||
- ROI calculation for different optimization strategies
|
||||
|
||||
### 7. Capacity Planning Integration
|
||||
|
||||
**Connect performance insights to infrastructure and resource planning:**
|
||||
|
||||
#### Capacity Planning Framework
|
||||
```
|
||||
Systematic Capacity Management:
|
||||
|
||||
Growth Projection:
|
||||
- User Growth: Customer acquisition and usage pattern evolution
|
||||
- Data Growth: Storage requirements and processing volume increases
|
||||
- Feature Growth: New capabilities and functionality impacts
|
||||
- Geographic Growth: Multi-region expansion and latency requirements
|
||||
|
||||
Resource Forecasting:
|
||||
- Compute Resources: CPU, memory, and processing power requirements
|
||||
- Storage Resources: Database, file system, and backup capacity needs
|
||||
- Network Resources: Bandwidth, connectivity, and latency optimization
|
||||
- Human Resources: Team scaling and expertise development needs
|
||||
|
||||
Scaling Strategy:
|
||||
- Horizontal Scaling: Instance multiplication and load distribution
|
||||
- Vertical Scaling: Resource enhancement and capacity increases
|
||||
- Auto-Scaling: Dynamic adjustment based on real-time demand
|
||||
- Manual Scaling: Planned capacity increases and maintenance windows
|
||||
|
||||
Cost Optimization:
|
||||
- Reserved Capacity: Long-term resource commitment and cost savings
|
||||
- Spot Instances: Variable pricing and cost-effective temporary capacity
|
||||
- Right-Sizing: Optimal resource allocation and waste elimination
|
||||
- Multi-Cloud: Provider comparison and cost arbitrage opportunities
|
||||
```
|
||||
|
||||
### 8. Output Generation and Recommendations
|
||||
|
||||
**Present simulation insights in actionable performance optimization format:**
|
||||
|
||||
```
|
||||
## System Behavior Simulation: [System Name]
|
||||
|
||||
### Performance Summary
|
||||
- Current Capacity: [baseline performance metrics]
|
||||
- Bottleneck Analysis: [primary performance constraints identified]
|
||||
- Optimization Potential: [improvement opportunities and expected gains]
|
||||
- Scaling Requirements: [resource needs for growth accommodation]
|
||||
|
||||
### Load Testing Results
|
||||
|
||||
| Scenario | Throughput | Latency (p95) | Error Rate | Resource Usage |
|
||||
|----------|------------|---------------|------------|----------------|
|
||||
| Normal Load | 500 RPS | 200ms | 0.1% | 60% CPU |
|
||||
| Peak Load | 1000 RPS | 800ms | 2.5% | 85% CPU |
|
||||
| Stress Test | 1500 RPS | 2000ms | 15% | 95% CPU |
|
||||
|
||||
### Bottleneck Analysis
|
||||
- Primary Bottleneck: [most limiting performance factor]
|
||||
- Secondary Bottlenecks: [additional constraints affecting performance]
|
||||
- Cascade Effects: [how bottlenecks impact other system components]
|
||||
- Resolution Priority: [recommended order of bottleneck addressing]
|
||||
|
||||
### Optimization Recommendations
|
||||
|
||||
#### Immediate Optimizations (0-30 days):
|
||||
- Quick Wins: [low-effort, high-impact improvements]
|
||||
- Configuration Tuning: [parameter adjustments and settings optimization]
|
||||
- Query Optimization: [database and application query improvements]
|
||||
- Caching Implementation: [strategic caching layer additions]
|
||||
|
||||
#### Medium-term Optimizations (1-6 months):
|
||||
- Architecture Changes: [structural improvements and scaling strategies]
|
||||
- Infrastructure Upgrades: [hardware and platform enhancements]
|
||||
- Code Refactoring: [application optimization and efficiency improvements]
|
||||
- Monitoring Enhancement: [observability and alerting system improvements]
|
||||
|
||||
#### Long-term Optimizations (6+ months):
|
||||
- Technology Migration: [platform or framework modernization]
|
||||
- System Redesign: [fundamental architecture improvements]
|
||||
- Capacity Expansion: [infrastructure scaling and geographic distribution]
|
||||
- Innovation Integration: [new technology adoption and competitive advantage]
|
||||
|
||||
### Capacity Planning
|
||||
- Current Capacity: [existing system limits and headroom]
|
||||
- Growth Accommodation: [resource scaling for projected demand]
|
||||
- Cost Implications: [budget requirements for capacity increases]
|
||||
- Timeline Requirements: [implementation schedule for capacity improvements]
|
||||
|
||||
### Monitoring and Alerting Strategy
|
||||
- Key Performance Indicators: [critical metrics for ongoing monitoring]
|
||||
- Alert Thresholds: [performance degradation warning levels]
|
||||
- Escalation Procedures: [response protocols for performance issues]
|
||||
- Regular Review Schedule: [ongoing optimization and capacity assessment]
|
||||
```
|
||||
|
||||
### 9. Continuous Performance Learning
|
||||
|
||||
**Establish ongoing simulation refinement and system optimization:**
|
||||
|
||||
#### Performance Validation
|
||||
- Real-world performance comparison to simulation predictions
|
||||
- Optimization effectiveness measurement and validation
|
||||
- User experience correlation with system performance metrics
|
||||
- Business impact assessment of performance improvements
|
||||
|
||||
#### Model Enhancement
|
||||
- Simulation accuracy improvement based on actual system behavior
|
||||
- Load pattern refinement and user behavior modeling
|
||||
- Bottleneck prediction enhancement and early warning systems
|
||||
- Optimization strategy effectiveness tracking and improvement
|
||||
|
||||
## Usage Examples
|
||||
|
||||
```bash
|
||||
# Web application performance simulation
|
||||
/performance:system-behavior-simulator Simulate e-commerce platform performance under Black Friday traffic with 10x normal load
|
||||
|
||||
# API service scaling analysis
|
||||
/performance:system-behavior-simulator Model REST API performance for mobile app with 1M+ daily active users and geographic distribution
|
||||
|
||||
# Database performance optimization
|
||||
/performance:system-behavior-simulator Simulate database performance for analytics workload with real-time reporting requirements
|
||||
|
||||
# Microservices capacity planning
|
||||
/performance:system-behavior-simulator Model microservices mesh performance under various failure scenarios and auto-scaling conditions
|
||||
```
|
||||
|
||||
## Quality Indicators
|
||||
|
||||
- **Green**: Comprehensive load modeling, validated bottleneck analysis, quantified optimization strategies
|
||||
- **Yellow**: Good load coverage, basic bottleneck identification, estimated optimization benefits
|
||||
- **Red**: Limited load scenarios, unvalidated bottlenecks, qualitative-only optimization suggestions
|
||||
|
||||
## Common Pitfalls to Avoid
|
||||
|
||||
- Load unrealism: Testing with artificial patterns that don't match real usage
|
||||
- Bottleneck tunnel vision: Focusing on single constraints while ignoring others
|
||||
- Optimization premature: Optimizing for problems that don't exist yet
|
||||
- Capacity under-planning: Not accounting for growth and traffic spikes
|
||||
- Monitoring blindness: Not establishing ongoing performance visibility
|
||||
- Cost ignorance: Optimizing performance without considering budget constraints
|
||||
|
||||
Transform system performance from reactive firefighting into proactive, data-driven optimization through comprehensive behavior simulation and capacity planning.
|
||||
Reference in New Issue
Block a user