Files
pos-system/docs/en/skills/performance-optimization.md
Ho Ngoc Hai 478254400a Refactor service documentation and enhance bilingual support
- 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.
2026-01-01 10:06:27 +07:00

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

  1. Use indexes, avoid N+1 queries
  2. Monitor memory usage, detect leaks
  3. Cache frequently accessed data
  4. Configure connection pools appropriately
  5. Profile regularly to identify bottlenecks

Resources