Performance: Health check endpoints
MEDIUM IMPACT
Health check endpoints affect server responsiveness and uptime monitoring, impacting how quickly a system can report its status without slowing down main request handling.
app.get('/health', (req, res) => { // Simple quick check res.json({ status: 'ok' }); });
app.get('/health', (req, res) => { // Heavy synchronous CPU operation let sum = 0; for(let i = 0; i < 1e8; i++) { sum += i; } res.json({ status: 'ok', data: sum }); });
| Pattern | CPU Usage | Event Loop Blocking | Response Time | Verdict |
|---|---|---|---|---|
| Heavy sync CPU operation on health check | High | Yes, blocks event loop | 100+ ms | [X] Bad |
| Simple static JSON response | Minimal | No | <1 ms | [OK] Good |