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

From: Michael Albinus <[email-masked]>
Date: Fri, 17 May 2024 16:57:58 +0200

Dmitry Gutov <[email-masked]> writes:

> Hi Michael,

Hi Dmitry,

>> If we want to go into detail, we need a clean testbed. In your tests, I
>> don't know whether another connection already exists which Tramp could
>> reuse due to your ControlMaster settings.
>
> Like I said, it does: in the background terminal I'm using ssh with
> the same connection. But you could probably replicate the experiment
> without much trouble. Do you have access to fencepost?
>
>> And we need to separate the
>> time the "ssh ..." call takes inside Tramp, from the other time when
>> Tramp does some roundtrips for the initialization. We must count the
>> time Tramp needs when tramp-verbose has a higher level. Etc pp.
>
> I could insert some (benchmark-progn ...) forms at your direction
> instead, to measure some blocks in the code. That's often a more
> expedient investigation tool.
>
>> Do we need this? We have seen that Tramp doesn't touch Control* options
>> when you set tramp-use-connection-share to nil. And that's what this bug
>> report is about.
>
> My question is, shouldn't ControlMaster be able to speed the process
> up, at least somewhat? The complaint isn't that the operation remains
> somewhat slow (though it does), but that I'm not seeing any
> statistically significant improvement from ControlMaster - which
> should seemingly be used and useful.

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.

> 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. But of course, there's no obligation for you to do so.

Best regards, Michael.