- Updated service template structure in `ARCHITECTURE.md` and `README.md` for clarity and usability. - Enhanced bilingual documentation across skills, increasing the number of available skills from 15 to 25. - Added new sections on event-driven architecture, inter-service communication, and performance optimization. - Improved formatting and removed outdated references to streamline the documentation experience.
1.5 KiB
1.5 KiB
name, description
| name | description |
|---|---|
| performance-optimization | Performance optimization patterns for GoodGo microservices including database query optimization, memory leak detection, profiling, connection pooling, and caching strategies. |
Performance Optimization Patterns
When to Use This Skill
Use this skill when:
- Optimizing database queries
- Detecting and fixing memory leaks
- Profiling application performance
- Optimizing connection pooling
- Improving caching strategies
- Identifying N+1 query problems
Key Patterns
Database Query Optimization
// Avoid N+1 queries
// Bad: Multiple queries
for (const user of users) {
user.orders = await orderRepository.findByUserId(user.id);
}
// Good: Single query with join
const users = await userRepository.findAll({
include: { orders: true },
});
Memory Profiling
// Monitor memory usage
const profiler = new MemoryProfiler();
profiler.start(); // Monitor every minute
Batch Operations
// Batch database operations
await batchOperations.batchCreate(items, 100); // Process 100 at a time
Best Practices
- Use indexes, avoid N+1 queries
- Monitor memory usage, detect leaks
- Cache frequently accessed data
- Configure connection pools appropriately
- Profile regularly to identify bottlenecks
Resources
- Caching Patterns
- Observability & Monitoring
- Skill Source:
.cursor/skills/performance-optimization/SKILL.md