Many APIs slow down because lifetime choices are wrong.
❌ Common Mistake
Using Transient for heavy services:
services.AddTransient<EmailService>();
✔ Correct
Use Singleton for stateless services:
services.AddSingleton<IEmailSender, EmailService>();
💡 Why?
-
Fewer allocations
-
Less GC pressure
-
Faster resolving
-
More consistent performance
