<?xml version="1.0" encoding="utf-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Server Optimization</title> <link rel="stylesheet" type="text/css" href="styles.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /> <style type="text/css"> body { background-image: url('images/draft.png'); background-repeat: no-repeat; background-position: top left; /* The following properties make the watermark "fixed" on the page. */ /* I think that's just a bit too distracting for the reader... */ /* background-attachment: fixed; */ /* background-position: center center; */ }</style> <link rel="home" href="index.html" title="Version Control with Subversion [DRAFT]" /> <link rel="up" href="svn.serverconfig.html" title="Chapter 6. Server Configuration" /> <link rel="prev" href="svn.serverconfig.operational-logging.html" title="High-level Logging" /> <link rel="next" href="svn.serverconfig.multimethod.html" title="Supporting Multiple Repository Access Methods" /> </head> <body> <div xmlns="" id="vcws-version-notice"> <p>This text is a work in progress—highly subject to change—and may not accurately describe any released version of the Apache™ Subversion® software. Bookmarking or otherwise referring others to this page is probably not such a smart idea. Please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a> for stable versions of this book.</p> </div> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">Server Optimization</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="svn.serverconfig.operational-logging.html">Prev</a> </td> <th width="60%" align="center">Chapter 6. Server Configuration</th> <td width="20%" align="right"> <a accesskey="n" href="svn.serverconfig.multimethod.html">Next</a></td> </tr> </table> <hr /> </div> <div class="sect1" title="Server Optimization"> <div class="titlepage"> <div> <div> <h2 class="title" style="clear: both"><a id="svn.serverconfig.optimization"></a>Server Optimization</h2> </div> </div> </div> <p>Part of the due diligence when offering a service such as a Subversion server involves capacity planning and performance tuning. Subversion doesn't tend to be particularly greedy in terms of server resources such as CPU cycles and memory, but any service can benefit from optimizations, especially when usage of the service skyrockets<sup>[<a id="idp17016096" href="#ftn.idp17016096" class="footnote">75</a>]</sup>. In this section, we'll discuss some ways you can tweak your Subversion server configuration to offer even better performance and scalability.</p> <div class="sect2" title="Data Caching"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="svn.serverconfig.optimization.caching"></a>Data Caching</h3> </div> </div> </div> <p>Generally speaking, the most expensive part of a Subversion server's job is fetching data from the repository. Subversion 1.6 attempted to offset this cost by introducing some in-memory caching of certain classes of data read from the repository. But Subversion 1.7 takes this a step further, not only caching the results of some of the more costly operations, but also by providing in each of the available servers the means by which fine-tune the size and some behaviors of the cache.</p> <p>For <span class="command"><strong>svnserve</strong></span>, you can specify the size of the cache using the <code class="option">--memory-cache-size</code> (<code class="option">-M</code>) command-line option. You can also dictate whether <span class="command"><strong>svnserve</strong></span> should attempt to cache content fulltexts and deltas via the boolean <code class="option">--cache-fulltexts</code> and <code class="option">--cache-txdeltas</code> options, respectively.</p> <div class="informalexample"> <pre class="screen"> $ svnserve -d -r /path/to/repositories \ --memory-cache-size 1024 \ --cache-txdeltas yes \ --cache-fulltexts yes … $ </pre> </div> <p><span class="command"><strong>mod_dav_svn</strong></span> provides the same degree of cache configurability via <code class="filename">httpd.conf</code> directives. The <code class="literal">SVNInMemoryCacheSize</code>, <code class="literal">SVNCacheFullTexts</code>, and <code class="literal">SVNCacheTextDeltas</code> directives may be used at the server configuration level to control Subversion's data cache characteristics:</p> <div class="informalexample"> <pre class="programlisting"> <IfModule dav_svn_module> # Enable a 1 Gb Subversion data cache for both fulltext and deltas. SVNInMemoryCacheSize 1048576 SVNCacheTextDeltas On SVNCacheFullTexts On </IfModule> </pre> </div> <p>So what settings should you use? Certainly you need to consider what resources are available on your server. To get any benefit out of the cache at all, you'll probably want to let the cache be at least large enough to hold all the files which are most commonly accessed in your repository (for example, your project's <code class="filename">trunk</code> directory tree).</p> <div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Tip"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Tip]" src="images/tip.png" /> </td> <th align="left">Tip</th> </tr> <tr> <td align="left" valign="top"> <p>Setting the memory cache size to <code class="literal">0</code> will disable this enhanced caching mechanism and cause Subversion to fall back to using the older cache mechanisms introduced in Subversion 1.6.</p> </td> </tr> </table> </div> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p>Currently, only repositories which make use of the FSFS backend data store make use of this data caching functionality.</p> </td> </tr> </table> </div> </div> <div class="sect2" title="Network Compression of Data"> <div class="titlepage"> <div> <div> <h3 class="title"><a id="svn.serverconfig.optimization.compression"></a>Network Compression of Data</h3> </div> </div> </div> <p>Compressing the data transmitted across the wire can greatly reduce the size of those network transmissions, but comes at the cost of server (and client) CPU cycles. Depending on your server's CPU capacity, the typical access patterns of the clients who use your servers, and the bandwidth of the networks between them, you might wish to fine tune just how hard your server will work to compress the data it sends across the wire. To assist with this fine tuning process, Subversion 1.7 offers the <code class="option">--compression</code> (<code class="option">-c</code>) option to <span class="command"><strong>svnserve</strong></span> and the <code class="literal">SVNCompressionLevel</code> directive for <span class="command"><strong>mod_dav_svn</strong></span>. Both accept a value which is an integer between 0 and 9 (inclusive), where 9 offers the best compression of wire data, and 0 disables compression altogether.</p> <p>For example, on a local area network (LAN) with 1-Gigabit connections, it might not make sense to have the server compress its network transmissions (which also forces the clients to decompress them), as the network itself is so fast that users won't really benefit from the smaller overall network payload. On the other hand, servers which are accessed primarily by clients with low-bandwidth connections would be doing those clients a favor by minimizing the overall size of its network communications.</p> </div> <div class="footnotes"> <br /> <hr width="100" align="left" /> <div class="footnote"> <p><sup>[<a id="ftn.idp17016096" href="#idp17016096" class="para">75</a>] </sup>In Subversion's case, the skyrocketing affect is, of course, due to its cool name. Well, that and its popularity, reliability, ease of use….</p> </div> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="svn.serverconfig.operational-logging.html">Prev</a> </td> <td width="20%" align="center"> <a accesskey="u" href="svn.serverconfig.html">Up</a> </td> <td width="40%" align="right"> <a accesskey="n" href="svn.serverconfig.multimethod.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">High-level Logging </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> Supporting Multiple Repository Access Methods</td> </tr> </table> </div> <div xmlns="" id="vcws-footer"> <hr /> <img src="images/cc-by.png" style="float: right;" /> <p>You are reading <em>Version Control with Subversion</em> (for Subversion 1.8), by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato.</p> <p>This work is licensed under the <a href="http://creativecommons.org/licenses/by/2.0/">Creative Commons Attribution License v2.0</a>.</p> <p>To submit comments, corrections, or other contributions to the text, please visit <a href="http://www.svnbook.com/">http://www.svnbook.com/</a>.</p> </div> </body> </html>