// const cluster = require('cluster') // // if (cluster.isMaster) { // const numCPUs = require('os').cpus().length // global['a'] = 1 // console.log('numCPUs=>>>', numCPUs) // for (let i = 0; i < numCPUs; i++) { // // 创建子进程模拟线上请求的隔离方便global变量的使用保持与FC环境的一致性 // cluster.fork() // } // cluster.on('exit', function (worker, code, signal) { // // console.log('Worker %d died with code/signal %s. Restarting worker...', worker.process.pid, signal || code); // cluster.fork(); // }) // } else { // if (!global['a']) { // global['a'] = 0 // } // global['a'] += 1 // console.log('=>>>>', global['a'], new Date()) // const express = require('express') // // Workers share the TCP connection in this server // const app = express() // // app.get('/', function (req, res) { // res.send('Hello World!' + new Date()); // process.exit() // }) // // // All workers use this port // app.listen(8080) // }