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 2011/02/04 11:12:00 UTC

svn commit: r1067130 - /subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c

Author: stefan2
Date: Fri Feb  4 10:11:59 2011
New Revision: 1067130

URL: http://svn.apache.org/viewvc?rev=1067130&view=rev
Log:
On the performance branch, add cache configuration parameters
already available to svnserve to mod_dav_svn: SVNInMemoryCacheSize
and SVNMaxOpenFileHandles.

* subversion/mod_dav_svn/mod_dav_svn.c:
 (parse_number, SVNInMemoryCacheSize_cmd,  SVNMaxOpenFileHandles_cmd):
  new functions to parse the new parameters.
  (cmds): add commands for the new parameters

Modified:
    subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c

Modified: subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c?rev=1067130&r1=1067129&r2=1067130&view=diff
==============================================================================
--- subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/performance/subversion/mod_dav_svn/mod_dav_svn.c Fri Feb  4 10:11:59 2011
@@ -34,6 +34,7 @@
 #include "svn_version.h"
 #include "svn_fs.h"
 #include "svn_utf.h"
+#include "svn_ctype.h"
 #include "svn_dso.h"
 #include "mod_dav_svn.h"
 
@@ -421,6 +422,50 @@ SVNSpecialURI_cmd(cmd_parms *cmd, void *
   return NULL;
 }
 
+
+static apr_uint64_t
+parse_number(const char *arg)
+{
+  const char *c;
+  for (c = arg; *c != 0; ++c)
+    if (!svn_ctype_isdigit (*c))
+      return (apr_uint64_t)(-1);
+
+  return apr_strtoi64(arg, NULL, 0);
+}
+
+static const char *
+SVNInMemoryCacheSize_cmd(cmd_parms *cmd, void *config, const char *arg1)
+{
+  svn_fs_cache_config_t settings = *svn_fs_get_cache_config();
+
+  apr_uint64_t value = parse_number(arg1);
+  if (value == (apr_uint64_t)(-1))
+    return "Invalid decimal number for the SVN cache size.";
+
+  settings.cache_size = value * 0x100000;
+
+  svn_fs_set_cache_config(&settings);
+
+  return NULL;
+}
+
+static const char *
+SVNMaxOpenFileHandles_cmd(cmd_parms *cmd, void *config, const char *arg1)
+{
+  svn_fs_cache_config_t settings = *svn_fs_get_cache_config();
+
+  apr_uint64_t value = parse_number(arg1);
+  if (value == (apr_uint64_t)(-1))
+    return "Invalid decimal number for the open file handle count.";
+
+  settings.file_handle_count = (apr_size_t)value;
+
+  svn_fs_set_cache_config(&settings);
+
+  return NULL;
+}
+
 
 /** Accessor functions for the module's configuration state **/
 
@@ -859,6 +904,19 @@ static const command_rec cmds[] =
                "enables server advertising of support for version 2 of "
                "Subversion's HTTP protocol (default values is On)."),
 
+  /* per server */
+  AP_INIT_TAKE1("SVNInMemoryCacheSize", SVNInMemoryCacheSize_cmd, NULL,
+               RSRC_CONF,
+               "specify the maximum size im MB per process of Subversion's "
+               "in-memory object cache (default values is 128 if threading "
+               "is supported, 16 if not; 0 deactivates the cache)."),
+
+  /* per server */
+  AP_INIT_TAKE1("SVNMaxOpenFileHandles", SVNMaxOpenFileHandles_cmd, NULL,
+               RSRC_CONF,
+               "specify the maximum of unused file handles kept open per "
+               "process (default values is 16)."),
+
   { NULL }
 };