You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/08/04 00:46:10 UTC

svn commit: r982057 - in /subversion/branches/performance/subversion/svnserve: main.c server.h

Author: stefan2
Date: Tue Aug  3 22:46:10 2010
New Revision: 982057

URL: http://svn.apache.org/viewvc?rev=982057&view=rev
Log:
Add "compression", "memory-cache-size" and "open-file-count"
command line parameters to svnserve. The latter two are only
available (on the CL) if FSFS is supported.

Currently, the file handle cache is not being used but will be soon.

* subversion/svnserve/server.h
  (serve_params_t): add FSFS data and file handle cache sizes
* subversion/svnserve/main.c
  (svnserve__options): add command line option definitions
  (main): parse the new parameters; update the FSFS cache settings

Modified:
    subversion/branches/performance/subversion/svnserve/main.c
    subversion/branches/performance/subversion/svnserve/server.h

Modified: subversion/branches/performance/subversion/svnserve/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svnserve/main.c?rev=982057&r1=982056&r2=982057&view=diff
==============================================================================
--- subversion/branches/performance/subversion/svnserve/main.c (original)
+++ subversion/branches/performance/subversion/svnserve/main.c Tue Aug  3 22:46:10 2010
@@ -57,6 +57,11 @@
 
 #include "server.h"
 
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+#include "libsvn_fs_fs/fs_fs.h"
+#endif
+
+
 /* The strategy for handling incoming connections.  Some of these may be
    unavailable due to platform limitations. */
 enum connection_handling_mode {
@@ -187,6 +192,33 @@ static const apr_getopt_option_t svnserv
         "at the same time is not supported in daemon mode.\n"
         "                             "
         "Use inetd mode or tunnel mode if you need this.]")},
+    {"compression",      'c', 1,
+     N_("compression level to use for network transmissions\n"
+        "                             "
+        "[0 .. no compression, 5 .. default, \n"
+        "                             "
+        " 9 .. maximum compresssion]")},
+
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+    {"memory-cache-size", 'M', 1, 
+     N_("size of the extra in-memory cache in MB used to\n"
+        "                             "
+        "minimize redundant operations.\n"
+        "                             "
+        "Default is 128 and 16 for non-threaded mode.\n"
+        "                             "
+        "[used for FSFS repositories only]")},
+
+    {"open-file-count", 'F', 1, 
+     N_("maximum number of files kept open after usage\n"
+        "                             "
+        "to reduce OS and I/O overhead.\n"
+        "                             "
+        "Default is 64 and 16 for non-threaded mode.\n"
+        "                             "
+        "[used for FSFS repositories only]")},
+#endif
+
 #ifdef CONNECTION_HAVE_THREAD_OPTION
     /* ### Making the assumption here that WIN32 never has fork and so
      * ### this option never exists when --service exists. */
@@ -430,6 +462,8 @@ int main(int argc, const char *argv[])
   params.authzdb = NULL;
   params.compression_level = SVNDIFF1_COMPRESS_LEVEL;
   params.log_file = NULL;
+  params.memory_cache_size = -1;
+  params.open_file_count = -1;
 
   while (1)
     {
@@ -529,6 +563,22 @@ int main(int argc, const char *argv[])
           handling_mode = connection_mode_thread;
           break;
 
+        case 'c':
+          params.compression_level = atoi(arg);
+          if (params.compression_level < 0)
+            params.compression_level = 0;
+          if (params.compression_level > 9)
+            params.compression_level = 9;
+          break;
+
+        case 'M':
+          params.memory_cache_size = 0x100000 * apr_strtoi64(arg, NULL, 0);
+          break;
+
+        case 'F':
+          params.open_file_count = apr_strtoi64(arg, NULL, 0);
+          break;
+
 #ifdef WIN32
         case SVNSERVE_OPT_SERVICE:
           if (run_mode != run_mode_service)
@@ -776,6 +826,32 @@ int main(int argc, const char *argv[])
     winservice_running();
 #endif
 
+#ifdef SVN_LIBSVN_FS_LINKS_FS_FS
+  /* Configure FSFS caches for maximum efficiency with svnserve. 
+   * For pre-forked (i.e. multi-processed) mode of operation,
+   * keep the per-process caches smaller than the default.
+   * Also, apply the respective command line parameters, if given. */
+  {
+    svn_fs_fs__cache_config_t settings = *svn_fs_fs__get_cache_config();
+
+    if (params.memory_cache_size != -1)
+      settings.cache_size = params.memory_cache_size;
+    else if (handling_mode != connection_mode_thread)
+      settings.cache_size = 0x1000000;
+
+    if (params.open_file_count != -1)
+      settings.file_handle_count = params.open_file_count;
+    else if (handling_mode != connection_mode_thread)
+      settings.file_handle_count = 16;
+
+    settings.cache_fulltexts = TRUE;
+    settings.cache_txdeltas = FALSE;
+    settings.single_threaded = handling_mode != connection_mode_thread;
+
+    svn_fs_fs__set_cache_config(&settings);
+  }
+#endif
+
   while (1)
     {
 #ifdef WIN32

Modified: subversion/branches/performance/subversion/svnserve/server.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svnserve/server.h?rev=982057&r1=982056&r2=982057&view=diff
==============================================================================
--- subversion/branches/performance/subversion/svnserve/server.h (original)
+++ subversion/branches/performance/subversion/svnserve/server.h Tue Aug  3 22:46:10 2010
@@ -107,6 +107,13 @@ typedef struct serve_params_t {
      fall back to txdelta "version 0" bypassing zlib entirely.
      Defaults to SVNDIFF1_COMPRESS_LEVEL. */
   int compression_level;
+
+  /* Size of the in-memory cache (used by FSFS only). */
+  apr_uint64_t memory_cache_size;
+
+  /* Number of handles kept open independently of there actual use
+     (used by FSFS only). */
+  apr_size_t open_file_count;
 } serve_params_t;
 
 /* Serve the connection CONN according to the parameters PARAMS. */



Re: svn commit: r982057 - in /subversion/branches/performance/subversion/svnserve: main.c server.h

Posted by Stefan Fuhrmann <st...@alice-dsl.de>.
Johan Corveleyn wrote:
> On Wed, Aug 4, 2010 at 12:46 AM,  <st...@apache.org> wrote:
>   
>> Author: stefan2
>> Date: Tue Aug  3 22:46:10 2010
>> New Revision: 982057
>>
>> URL: http://svn.apache.org/viewvc?rev=982057&view=rev
>> Log:
>> Add "compression", "memory-cache-size" and "open-file-count"
>> command line parameters to svnserve. The latter two are only
>> available (on the CL) if FSFS is supported.
>>     
>
> Just wondering: are these features only relevant for svnserve, or
> could they also be applicable (or a variation) to mod_dav_svn?
Those caches are active in FSFS per default although with
very conservative sizes, i.e.they are small. The caches are
much less effective in pre-fork servers (svnserve without
the -T parameter, Apache on most Unices).
>  If the
> latter, do you plan to add a way to configure those options for
> mod_dav_svn as well? Or are they available in some other way?
>   
I plan to make these settings available for mod_dav_svn as
well. Windows servers should benefit the most from the new
caches. However, you would need 64 bit builds of Apache
and mod_dav_svn to handle large (>1GB) caches.
> It would be nice if mod_dav_svn users could enjoy the same performance
> improvements as svnserve users (unless it's not possible for some
> technical reason of course).
>   
My idea is to provide a second caching level that is almost
identical to the current membuffer cache but uses a memory
mapped file to store the data. Thus, it can be shared among
multiple processes (e.g. pre-fork servers) and it allows for
moderate size (~16GB) caches under 32 bit.

-- Stefan^2.

Re: svn commit: r982057 - in /subversion/branches/performance/subversion/svnserve: main.c server.h

Posted by Johan Corveleyn <jc...@gmail.com>.
On Wed, Aug 4, 2010 at 12:46 AM,  <st...@apache.org> wrote:
> Author: stefan2
> Date: Tue Aug  3 22:46:10 2010
> New Revision: 982057
>
> URL: http://svn.apache.org/viewvc?rev=982057&view=rev
> Log:
> Add "compression", "memory-cache-size" and "open-file-count"
> command line parameters to svnserve. The latter two are only
> available (on the CL) if FSFS is supported.

Just wondering: are these features only relevant for svnserve, or
could they also be applicable (or a variation) to mod_dav_svn? If the
latter, do you plan to add a way to configure those options for
mod_dav_svn as well? Or are they available in some other way?

It would be nice if mod_dav_svn users could enjoy the same performance
improvements as svnserve users (unless it's not possible for some
technical reason of course).

Cheers,
-- 
Johan