Node.js与IIS部署共存时的内存问题排查求助
Node.js(Express)应用部署到IIS后数据库连接时出现内存问题
之前Node.js(Express)应用在PM2上运行一切正常,迁移至IIS并完成全部配置后,应用仅能正常处理静态页面,连接数据库获取数据时出现内存问题,报错截图如下:
经排查,报错出自以下代码片段:
const getDB = () => { return new Promise((resolve, reject) => { pool.get((err, db) => { if (err) reject(err) resolve(db) }) }); }
尝试增大堆内存大小,但问题仍未解决,相关代码如下:
'use strict' const v8 = require('v8') const totalHeapSize = v8.getHeapStatisctics().total_available_size let totalHeapSizeInGB = (totalHeapSize /1024 /1024/ 1024).toFixed(2) console.log('Total heap size (bytes) ${totalHeapSize}, (GB ~${totalHeapSizeInGB}')
现寻求该内存问题的解决方法。
内容的提问来源于stack exchange,提问作者Meral
相关产品推荐
相关产品推荐

