Hacker News new | ask | show | jobs
by ithrow 1807 days ago
Every time you save your edits Tramp makes a new connection to the remote server, it's slow(1sec vs 1ms) and becomes annoying waiting for the save all the time. For doing quick edits it doesn't matter but for doing dev all day it does.
2 comments

Configuring OpenSSH's ControlMaster setting here makes an enormous difference. Summary: it keeps a connection open for a while in case you want to connect to the same machine again. If you do, it reuses that connection so the new one is nearly instant.
I'll give it a try, thanks.
Examples, starting with a new connection to a server I haven't accessed recently:

  ᐅ time ssh myserver exit
  
  Executed in    1.66 secs
Now visiting it again uses the existing connection:

  ᐅ time ssh mastodon exit
  
  Executed in   55.89 millis
(Assume the hostname is identical in both cases. I edited one and not the other. Oops!)
Tramp offers different "connection methods" with different characteristics. For example, the scp connection method uses scp to copy files to/from the remote machine, and this implies a new ssh connection each time.

But the ssh connection method transfers the files inline, using base64 or uu encoding, and then you do not need a new connection each time the file is read or written.