Performance: Rate limiting
HIGH IMPACT
Rate limiting affects server response time and resource usage, impacting how quickly the server can handle requests and maintain responsiveness.
import rateLimit from 'express-rate-limit'; const limiter = rateLimit({ windowMs: 60000, // 1 minute max: 100, // limit each IP to 100 requests per window standardHeaders: true, legacyHeaders: false }); app.use(limiter);
app.use((req, res, next) => {
// No rate limiting
next();
});| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No rate limiting | N/A | N/A | N/A | [X] Bad |
| Basic in-memory rate limiting | N/A | N/A | N/A | [!] OK |
| Distributed Redis-backed rate limiting | N/A | N/A | N/A | [OK] Good |