ssh2_scp_recv high CPU utilization
Posted: Wed Apr 04, 2007 7:07 am
I am transferring a file via SCP over a 100MB LAN connection. There are no errors on the interfaces and there is a switch between them which also shows no errors. I am saying this to ensure everyone there is no network issues. Anyway, I do something like this.
It transfers data VERY fast, but the problem is it's killing my dual CPU V210 with 2GB of RAM. Executing the script to pull just one file of 20MB across puts the CPU at 98% and everything else on the system crawls. Of course it only takes a second, but my goal is to use this script to pull several gigabytes of data across using multiple processes calling the same command. Any ideas on why it is so CPU intensive? When I copy over SCP from command line it is not killing the box as bad? I have to run 20 of these scripts concurrently throughout the day and don't want to kill the box. I also tried using fopen(ssh2.sftp), but this is extremely slow no matter what I try. Any help would be appreciated on the fastest method for getting a file via ssh2 (SFTP or SCP) as long as it's fast and doesn't take to many resources!
Code: Select all
if (!ssh2_scp_recv($this->connection, $this->remotefile, $this->localfile)) {
return 1;
} else {
return 0;
}