以下是Node.js在Debian上的性能调优方法:
fs.promises.readFile()等异步API,避免同步操作阻塞事件循环。cluster模块充分利用多核CPU。net.ipv4.ip_local_port_range,设置net.ipv4.tcp_tw_reuse等。--prof生成性能分析报告,--inspect进行内存分析。--max-old-space-size设置内存上限。--trace_gc参数了解垃圾回收情况。fast-json-stringify替代JSON.stringify。