Performance & Quality Guidelines
This document serves as an index of "Common Pitfalls" and recommended practices for WepNG. Refer to the dedicated documents for detailed examples and solutions.
🛑 Critical Anti-Patterns
| Pattern Name | Impact | Description |
|---|---|---|
| N+1 Queries | Performance | Executing a query for each item in a list. The #1 performance killer. |
| Loop of Death | Timeout / Crash | Analyzing/Saving deep object graphs inside nested loops. |
| Sync-over-Async | Deadlocks | Using .Result or .Wait() on async tasks in ASP.NET. |
| Resource Leaks | Instability | Un-disposed DataContext objects consuming memory. |
| Swallowed Exceptions | Hidden Bugs | Empty catch {} blocks that hide critical failures. |
| Untracked Fire-and-Forget | Data Loss | Using Task.Run without tracking, risking data loss on AppPool recycle. |
| Client-Side Evaluation | Memory | Fetching all rows (ToList) before filtering in memory. |
| Blocking I/O | Starvation | Sending emails or HTTP requests synchronously. |
| Session Locking | UX Latency | Serialized execution of requests due to ASP.NET session locks. |
🛠️ Stabilization Strategy
All performance remediations must follow the Performance Stabilization Skill.
🟢 Best Practices
Command/Query Separation (CQS)
To break away from "God Controllers", separate operations:
- Query: Asks for data, modifies nothing. (e.g.,
GetOrderById) - Command: Modifies data, returns no complex data. (e.g.,
ApproveOrder)