Performance: IPC communication between processes
MEDIUM IMPACT
This affects the responsiveness and throughput of applications that rely on multiple Node.js processes communicating with each other.
const { fork } = require('child_process');
const child = fork('child.js');
setInterval(() => {
const smallData = { timestamp: Date.now() };
child.send(smallData);
}, 100);const { fork } = require('child_process');
const child = fork('child.js');
setInterval(() => {
const largeData = Buffer.alloc(10 * 1024 * 1024, 'a'); // 10MB buffer
child.send(largeData);
}, 10);| Pattern | Message Size | Frequency | Event Loop Impact | Verdict |
|---|---|---|---|---|
| Large frequent messages | 10MB | Every 10ms | Blocks event loop for 10-20ms | [X] Bad |
| Small infrequent messages | Few bytes | Every 100ms | Minimal event loop impact | [OK] Good |