tags:

views:

1048

answers:

6

I have been doing some remote development using emacs tramp and found that it was quite slow. Every time I save a file, it takes about 10 seconds to complete the save. So, now I am using rsync to transfer the files remotely and it works much faster, it takes about a second plus the local saves from emacs are instant. Are there any configuration options within tramp to get it to run as fast as rsync does on the command line? Are there any advantages to using tramp instead of rsync even though I am seeing such poor performance?

+3  A: 

If you're using tramp for ssh/scp functionality, you'll find opening a persistent SSH connection will make tramp operations a lot faster: they'll reuse the existing connection rather than creating a fresh one each time, cutting out a great deal of cryptographic overhead without affecting security. See this article on the SSH ControlMaster functionality.

It still takes around 10 seconds, but I am able to connect to other servers instantaneously. I wonder if it could be a server problem.
dr_pepper
+2  A: 

Are you aware of the section in the tramp documentation on gnu.org that mentions using rsync? It says, in part:

5.3 External transfer methods

The external transfer methods operate through multiple channels, using the remote shell connection for many actions while delegating file transfers to an external transfer utility.

This saves the overhead of encoding and decoding that multiplexing the transfer through the one connection has with the inline methods.

...

rsync — ssh and rsync Using the ssh command to connect securely to the remote machine and the rsync command to transfer files is almost identical to the scp method.

While rsync performs much better than scp when transferring files that 
exist on both hosts, this advantage is lost if the file exists only on one side 
of the connection.

The rsync based method may be considerably faster than the rcp based
methods when writing to the remote system. Reading files to the local
machine is no faster than with a direct copy.

This method supports the ‘-p’ hack.
Bryan Oakley
+2  A: 

While tramp can be configured to use a large number of transport method, I suppose you're using ssh to connect to the remote server.

I believe most of the time it takes to complete the operation comes from setting up a connection and authenticating. If you're using a new enough version of OpenSSH, this can be helped by using the connection sharing feature, see ControlMaster in ssh_config(5).

I suggest you try

ControlMaster auto

and see if that improves the situation.

A: 

Since you said earlier that you have a problem on a particular server, check the sshd config file on the problem machine. It's probably something like /etc/ssh/sshd_config.

Look for a config option named "UseDNS". Set that to "No."

See if that doesn't speed things up for you. If so, then ssh is probably timing out waiting on a reverse dns lookup that you likely don't care about.

darrint
A: 

Recently I've come to embrace sshfs so that the remote files are locally editable. Works well for Linux, Mac and Unix systems and puts the ssh parts in one command rather than every access. And exists entirely in User space.

pajato0
A: 

For me the speed up was significant! Now using tramp is really pleasant. I also prefer it over sshfs since I also compile from within emacs and tramp does the remote compilation for me and interprets the compiler's error messages for me:)

José Antonio Álvarez Ruiz