Performance: Event-driven architecture
MEDIUM IMPACT
This affects how the server handles requests and internal events, impacting response time and resource usage.
app.get('/data', async (req, res) => { const result = await heavyAsyncOperation(); res.send(result); });
app.get('/data', (req, res) => {
const result = heavySyncOperation();
res.send(result);
});| Pattern | Event Loop Blocking | Async Handling | Response Time Impact | Verdict |
|---|---|---|---|---|
| Synchronous heavy tasks in event handlers | High (blocks event loop) | No | Increases response time | [X] Bad |
| Asynchronous heavy tasks in event handlers | Low (non-blocking) | Yes | Improves response time | [OK] Good |