This patch combines all patches from the performance branch that
implement the svnadmin command line UI part of the membuffer cache
configuration.
Revisions merged partially from /branches/performance
(excluding all changes not related to the membuffer cache):
982057, 987886
* subversion/svnserve/server.h
(serve_params_t): add cache size parameter
* subversion/svnserve/main.c
(svnserve__options): add "-M" parameter
(main): initialize, parse and apply the new parameter
git-svn-id: https://svn.apache.org/repos/asf/subversion/branches/integrate-cache-membuffer@998852 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/svnserve/main.c b/subversion/svnserve/main.c
index 3273988..f52b6d7 100644
--- a/subversion/svnserve/main.c
+++ b/subversion/svnserve/main.c
@@ -189,6 +189,16 @@
"at the same time is not supported in daemon mode.\n"
" "
"Use inetd mode or tunnel mode if you need this.]")},
+ {"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 for threaded and 16 for non-\n"
+ " "
+ "threaded mode.\n"
+ " "
+ "[used for FSFS repositories only]")},
#ifdef CONNECTION_HAVE_THREAD_OPTION
/* ### Making the assumption here that WIN32 never has fork and so
* ### this option never exists when --service exists. */
@@ -431,6 +441,7 @@
params.pwdb = NULL;
params.authzdb = NULL;
params.log_file = NULL;
+ params.memory_cache_size = (apr_uint64_t)-1;
while (1)
{
@@ -540,6 +551,10 @@
handling_mode = connection_mode_thread;
break;
+ case 'M':
+ params.memory_cache_size = 0x100000 * apr_strtoi64(arg, NULL, 0);
+ break;
+
#ifdef WIN32
case SVNSERVE_OPT_SERVICE:
if (run_mode != run_mode_service)
@@ -786,6 +801,25 @@
winservice_running();
#endif
+ /* Configure FS 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_cache_config_t settings = *svn_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;
+
+ settings.cache_fulltexts = TRUE;
+ settings.cache_txdeltas = FALSE;
+ settings.single_threaded = handling_mode != connection_mode_thread;
+
+ svn_fs_set_cache_config(&settings);
+ }
+
while (1)
{
#ifdef WIN32
diff --git a/subversion/svnserve/server.h b/subversion/svnserve/server.h
index f567db8..8a4b396 100644
--- a/subversion/svnserve/server.h
+++ b/subversion/svnserve/server.h
@@ -101,6 +101,9 @@
/* A filehandle open for writing logs to; possibly NULL. */
apr_file_t *log_file;
+
+ /* Size of the in-memory cache (used by FSFS only). */
+ apr_uint64_t memory_cache_size;
} serve_params_t;
/* Serve the connection CONN according to the parameters PARAMS. */