Node.js 节点scp2速度问题?
我使用节点服务器检查文件,并使用scp2将文件从一台服务器(EC2实例)传输到另一台服务器(商业服务器场)Node.js 节点scp2速度问题?,node.js,docker,file-transfer,scp,Node.js,Docker,File Transfer,Scp,我使用节点服务器检查文件,并使用scp2将文件从一台服务器(EC2实例)传输到另一台服务器(商业服务器场) copyFile(tmpZip, remotepath, opts) { return new Promise((resolve, reject) => { const Client = require('scp2').Client; const client = new Client(opts); let perc = 0; client.on('transfer'
copyFile(tmpZip, remotepath, opts) {
return new Promise((resolve, reject) => {
const Client = require('scp2').Client;
const client = new Client(opts);
let perc = 0;
client.on('transfer', (buffer, uploaded, total) => {
const currentPerc = Math.round(uploaded * 100 / total);
if (currentPerc > perc) {
perc = currentPerc;
console.log('[ %s ] - [ %s ] Copied %s%', new Date(), tmpZip, perc);
}
});
console.log('[ %s ] Copy started %s', new Date(), tmpZip);
client.upload(tmpZip, remotepath, err => {
if (err) {
console.error('[ %s ]Copy failed ', tmpZip, err);
reject(err);
return;
}
console.log('[ %s ]File copied!', tmpZip);
resolve();
});
});
}
我的选择是:
const opts = {
host,
username,
privateKey: Buffer.from(privateKey)
};
if (passphrase) {
opts.passphrase = passphrase;
}
我的问题是,节点服务器传输(仅传输,不检查)1GB文件大约需要20分钟,而普通bash scp只需要1分钟。
是否存在任何已知的scp2问题
更多信息:
节点服务器位于ubuntu 16.04服务器上的docker容器内,在此过程中不会产生更多的网络流量