Subject: bug#70901: 30.0.50; Tramp doesn't use ControlMaster even with (setq tramp-use-connection-share nil)

From: Dmitry Gutov <[email-masked]>
Date: Sat, 18 May 2024 05:29:28 +0300

Hi Michael,

On 17/05/2024 17:57, Michael Albinus wrote:

> Using ControlMaster or not should make a difference. If you want to
> measure time, I recommend to measure only the time Tramp calls "ssh ..."
> and receives the prompt. That is in the traces (even with timestamps).
> 
> 1. On a fresh booted system > 2 sec:
> 
> --8<---------------cut here---------------start------------->8---
> 16:48:11.758022 tramp-send-command (6) # exec ssh -o ControlMaster=auto -o ControlPath=/home/albinus/.cache/emacs/tramp.%C -o ControlPersist=no -e none gandalf || exit
> 16:48:13.919576 tramp-process-actions (6) #
> Last login: Fri May 17 16:48:11 2024 from 2002:6443:eb5:0:f832:242f:9e14:df3d
> [albinus@gandalf ~]$
> --8<---------------cut here---------------end--------------->8---
> 
> 2. In another Emacs instance, accessing the same host < 0.2 sec:
> 
> --8<---------------cut here---------------start------------->8---
> 16:50:13.291729 tramp-send-command (6) # exec ssh -o ControlMaster=auto -o ControlPath=/home/albinus/.cache/emacs/tramp.%C -o ControlPersist=no -e none gandalf || exit
> 16:50:13.481880 tramp-process-actions (6) #
> Last login: Fri May 17 16:50:11 2024 from 2002:6443:eb5:0:f832:242f:9e14:df3d
> [albinus@gandalf ~]$
> --8<---------------cut here---------------end--------------->8---
> 
> All other commands after this are Tramp's initialization on that host,
> which doesn't depend on ControlMaster.

Thank you.

It seems that ControlMaster does in fast get used - it shaves the 
initial connection from ~3 seconds down to ~1 second or a little less.

I suppose it's just that the remainder of the process takes a while too 
(additional 3 seconds for something as simple as 'ls'), so the 
difference is not as pronounced.

Perhaps it'd make sense to adjust the logging so that the first 
"...done" is printed right after the connection is established.

At the moment it looks like this:

05:26:32.739888 tramp-send-command (6) # exec ssh -q -l dgutov -e none 
fencepost.gnu.org || exit
...
Last login: Fri May 17 22:25:53 2024 from 82.102.62.129
dgutov@fencepost:~$
05:26:33.297344 tramp-process-actions (3) # Waiting for prompts from 
remote shell...done
...
05:26:35.959207 tramp-maybe-open-connection (3) # Opening connection 
*Async Shell Command* for [email-masked] using ssh...done

I'll do some more testing, just in case (on another system).

>> I'm planning to write a small article with recommendations on how to
>> configure Tramp for performance in a common setup, with the options
>> and explanations.
> 
> Nice. If you like you could show me this article for comments, before
> you publish.

Of course, no problem.