Engineering @ DoSelect
@dolftax
try {
global.config = require('./dev-config')
} catch (err) {
global.config = require('./config')
}
Key takeaway: Leave the configuration to deployer playbooks
Take a sip of BudLight and ask yourself again
Memory
Time
// To generate heap snapshot
require('heapdump')
// Run garbage collector
process.on('SIGUSR2', function () {
gc()
})
$ kill -USR2 <pid>
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork()
}
cluster.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`)
})
} else {
// Listen
}
`cluster` ain't enough
Websocket handshake might arrive at different workers
Maintain sticky session when balancing requests
@dolftax