summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentfredric@gmail.com>2010-09-29 16:56:48 +1300
committerKent Fredric <kentfredric@gmail.com>2010-09-29 16:56:48 +1300
commit5fc8f59388e93f1b1cdfb2e7ccb405e7c5d29b83 (patch)
treec6a89d264bc85c7adc8a46ff085d39341e600f9e /README/index.html
parent[doc] + merge option --ff-only (diff)
downloadperl-overlay-5fc8f59388e93f1b1cdfb2e7ccb405e7c5d29b83.tar.gz
perl-overlay-5fc8f59388e93f1b1cdfb2e7ccb405e7c5d29b83.tar.bz2
perl-overlay-5fc8f59388e93f1b1cdfb2e7ccb405e7c5d29b83.zip
[doc] + git+ssh multiplex trick
Diffstat (limited to 'README/index.html')
-rw-r--r--README/index.html100
1 files changed, 99 insertions, 1 deletions
diff --git a/README/index.html b/README/index.html
index 172692da5..7e37211f5 100644
--- a/README/index.html
+++ b/README/index.html
@@ -938,13 +938,111 @@ resolve the situation.</p></div>
<span class="na">mergeoptions</span> <span class="o">=</span> <span class="s">--ff-only</span>
</pre></div></div></div>
</div>
+<div class="sect2">
+<h3 id="_set_up_ssh_mulitplexing_for_speed">2.6. Set up SSH Mulitplexing for Speed</h3>
+<div class="paragraph"><p>This is one of my most convenient tricks. The slowest parts of <tt>git pull</tt> and
+<tt>git push</tt> are starting up the SSH connection. However, there is a way to
+eliminate this problem simply by opening a persistent tunnel, which <tt>git pull</tt>
+and <tt>git push</tt> automatically reuse.</p></div>
+<div class="sect3">
+<h4 id="_ssh_config">2.6.1. ~/.ssh/config</h4>
+<div class="paragraph"><p>Enter the ControlMaster option for OpenSSH.</p></div>
+<div class="quoteblock">
+<div class="content">
+<div class="paragraph"><p><strong>ControlMaster</strong></p></div>
+<div class="paragraph"><p>Enables the sharing of multiple sessions over a single network connection.
+When set to &#x201C;yes&#x201D;, ssh(1) will listen for connections on a control socket
+specified using the ControlPath argument. Additional sessions can connect to
+this socket using the same <strong>ControlPath</strong> with <strong>ControlMaster</strong> set to &#x201C;no&#x201D;
+(the default).</p></div>
+<div class="paragraph"><p>These sessions will try to reuse the master instance&#x2019;s network connection
+rather than initiating new ones, but will fall back to connecting normally if
+the control socket does not exist, or is not listening.</p></div>
+<div class="paragraph"><p>Setting this to &#x201C;ask&#x201D; will cause ssh to listen for control connections, but
+require confirmation using the SSH_ASKPASS program before they are accepted
+(see ssh-add(1) for details). If the <strong>ControlPath</strong> cannot be opened, ssh will
+continue without connecting to a master instance.</p></div>
+<div class="paragraph"><p>X11 and ssh-agent(1) forwarding is supported over these multiplexed
+connections, however the display and agent forwarded will be the one belonging
+to the master connection i.e. it is not possible to forward multiple displays
+or agents.</p></div>
+<div class="paragraph"><p>Two additional options allow for opportunistic multiplexing: try to use a
+master connection but fall back to creating a new one if one does not already
+exist. These options are: &#x201C;auto&#x201D; and &#x201C;autoask&#x201D;. The latter requires
+confirmation like the &#x201C;ask&#x201D; option.</p></div>
+</div>
+<div class="attribution">
+</div></div>
+<div class="paragraph"><p>So I set up my ~/.ssh/config as follows.</p></div>
+<div class="listingblock">
+<div class="content"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
+2
+3
+4
+5
+6</pre></div></td><td class="code"><div class="highlight"><pre><span class="c">#~/.ssh/config</span>
+ControlMaster auto
+ControlPath ~/.ssh/pool/%r@%h
+ServerAliveCountMax 6
+ServerAliveInterval 10
+TCPKeepAlive yes
+</pre></div>
+</td></tr></table></div></div>
+<div class="paragraph"><p>And we&#x2019;re set!.</p></div>
+</div>
+<div class="sect3">
+<h4 id="_first_a_few_benchmarks">2.6.2. First, a few benchmarks</h4>
+<div class="paragraph"><p>First, lets see how fast it is without the magic:</p></div>
+<div class="listingblock">
+<div class="content"><div class="highlight"><pre>&gt; <span class="nb">time </span><span class="k">for </span>i in <span class="k">$(</span> seq 0 10 <span class="k">)</span> ; <span class="k">do </span>git fetch github; <span class="k">done</span>
+
+real 0m47.798s
+user 0m0.226s
+sys 0m0.236s
+
+&gt; <span class="nb">time </span><span class="k">for </span>i in <span class="k">$(</span> seq 0 10 <span class="k">)</span> ; <span class="k">do </span>git fetch origin; <span class="k">done</span>
+
+real 0m48.444s
+user 0m0.235s
+sys 0m0.250s
+</pre></div></div></div>
+<div class="paragraph"><p>Averaging about 4.34s per fetch to Github, 4.40s to gentoo overlays.</p></div>
+<div class="paragraph"><p>SLOOW.</p></div>
+</div>
+<div class="sect3">
+<h4 id="_start_a_background_connection">2.6.3. Start a background connection</h4>
+<div class="paragraph"><p>With ControlMaster, you set up a long-lived SSH connection.</p></div>
+<div class="listingblock">
+<div class="content"><div class="highlight"><pre>&gt; ssh -fNn git@github.com
+&gt; ssh -fNn git@git.overlays.gentoo.org
+</pre></div></div></div>
+<div class="paragraph"><p>And we&#x2019;re truely really to start cooking with petrol.</p></div>
+</div>
+<div class="sect3">
+<h4 id="_post_configuration_benchmarks">2.6.4. Post Configuration Benchmarks</h4>
+<div class="listingblock">
+<div class="content"><div class="highlight"><pre>&gt; <span class="nb">time </span><span class="k">for </span>i in <span class="k">$(</span> seq 0 10 <span class="k">)</span> ; <span class="k">do </span>git fetch github; <span class="k">done</span>
+
+real 0m12.935s
+user 0m0.093s
+sys 0m0.193s
+
+&gt; <span class="nb">time </span><span class="k">for </span>i in <span class="k">$(</span> seq 0 10 <span class="k">)</span> ; <span class="k">do </span>git fetch origin; <span class="k">done</span>
+
+real 0m11.597s
+user 0m0.099s
+sys 0m0.191s
+</pre></div></div></div>
+<div class="paragraph"><p>O_o. Averaging about 1.175s and 1.05s respectively.</p></div>
+</div>
+</div>
</div>
</div>
</div>
<div id="footnotes"><hr/></div>
<div id="footer">
<div id="footer-text">
-Last updated 2010-09-29 13:27:58 NZDT
+Last updated 2010-09-29 14:37:13 NZDT
</div>
<div id="footer-badges">
<a href="http://validator.w3.org/check?uri=referer">