Karl E. Jorgensen wrote:
On Wed, Feb 09, 2005 at 09:48:26PM -0500, Roberto C. Sanchez wrote:Is there a way to nice the remote end of an ssh or scp session? I aske because I have two machines. One can fill a 100 Mbps pipe even enrypting for scp. However, the other is CPU bound and maxes out at 7 MBps (or ~60 Mbps). I usually initiate connections from the more powerful machine to the less powerful machine. I would like to know if I can do this on a per connection basis. All the information that I have found talks about nicing sshd (and by extension all of its child processes). However, I am in interested in a per connection solution. Is there a switch to ssh (that is not in the documentation) or an incantation that will have the remote end of the connection run at a lower priority or renice itself after starting?running at a lower priority is quiet easy: as you probably guessed: ssh otherbox nice /some/command but that will only lower the CPU priority on the other box - which usually has very little effect on network bandwidth usage... You may want to look into the "iprelay" package: # apt-get install iprelay and then as yourself: $ iprelay -d -b8192 2200:otherbox:22 $ ssh -o HostKeyAlias=otherbox -p 2200 localhost /some/command This would limit the bandwith on the SSH connection to about 8192 bytes/sec... Similar stuff can be used for scp(1). As usual, man(1) is your friend...
Thanks. I am not so much interested in limiting bandwidth usage, other than to the extent to which it helps me lower CPU utilization on the slower machine. I was thinking in terms of scheduling priority because that is more flexible. While your solution works, it is unaware of the other scheduled tasks on the remote box and what their processing needs are. For example, if I scp a 5 GB file and limit the bandwidth, then it will take much longer. Especially, since I may only be interested in having the machine be snappy for the 10 minutes that I need to log into it to do something. Say, for instance, that I limit the banwidth to 5 MBps. That will get CPU utilization down to about 70% (ballpark). Now, if I log in and do something that requires 70% CPU, the two processes will fight for resources. What I would like is for the scp process to yield to the other process.
<div target="WebDesigners"> This also comes in handy under other circumstances; $ iprelay -b2500 8000:localhost:80 # Point browser at http://localhost:8000 and you can see your website creations as a poor modem user would... </div>
This is good. I will need to start doing this with my web pages. -Roberto -- Roberto C. Sanchez http://familiasanchez.net/~sanchezr
Attachment:
signature.asc
Description: OpenPGP digital signature