[英]node js and postgresql reduce Cpu usage
In Node js i'm using postgresql Database.while i am inserting bulk data in DB the CPU usage is getting 10% to 15%.在 Node js 中,我使用的是 postgresql 数据库。当我在数据库中插入批量数据时,CPU 使用率达到 10% 到 15%。
I want to reduce the cpu usage 5% to 6%.我想将 CPU 使用率降低 5% 到 6%。
function execute(count) {
step(0);
function step(i) {
if (i < count) {
client.query("INSERT INTO test1 (firstname, lastname) values($1, $2)", ['Ronald', 'McDonald'], function (err, respose) {
// console.log(respose);
console.log("insert");
step(++i);
});
}
else {
selectQuery();
}
}
}
PostgreSQL has a directive in its configuration file that can cache data PostgreSQL 在其配置文件中有一个指令可以缓存数据
shared_buffers=3GB For 16 GB of RAM
This value is based on the amount of system RAM, which should be 20% of the RAM此值基于系统 RAM 的数量,应为 RAM 的 20%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.