> From: sussman@collab.net [mailto:sussman@collab.net]
> Sent: Tuesday, July 01, 2003 5:43 PM
> 2. As was already mentioned, because HTTP request is stateless, apache
> opens and closes/syncs the repository (BDB environment) with
> *every* request. (One user had write caching turned off on his
> server; this caused his http checkouts to arrive about 1 file
> every 2 seconds!) There's been discusion about keeping the
> repository open for the whole TCP/IP "connection session", and
> Sander has experimented with this, but it didn't seem to do much.
> Still need to investigate.
And here is the limited tested patch.
Sander
Log:
Cache open repository per connection.
* subversion/mod_dav_svn/repos.c
(dav_svn_get_resource): Store open repository in connection notes
table, keyed by location and repositoryname. Use this open
repository for the duration of the connection.
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c (revision 6386)
+++ subversion/mod_dav_svn/repos.c (working copy)
@@ -22,6 +22,7 @@
#include <http_protocol.h>
#include <http_log.h>
#include <http_core.h> /* for ap_construct_url */
+#include <util_script.h> /* for ap_find_path_info */
#include <mod_dav.h>
#define APR_WANT_STRFUNC
@@ -1076,6 +1077,8 @@
const char *repos_name;
const char *relative;
const char *repos_path;
+ const char *base_path;
+ const char *repos_key;
const char *version_name;
svn_error_t *serr;
dav_error *err;
@@ -1181,15 +1184,27 @@
/* Remember who is making this request */
repos->username = r->user;
- /* open the SVN FS */
- serr = svn_repos_open(&(repos->repos), fs_path, r->pool);
- if (serr != NULL)
+ /* Get the repository */
+ base_path = apr_pstrndup(r->pool, r->uri,
+ ap_find_path_info(r->uri, r->path_info));
+ repos_key = apr_pstrcat(r->pool, "mod_dav_svn:", base_path, root_path);
+ repos->repos = (void *)apr_table_get(r->connection->notes, repos_key);
+ if (repos->repos == NULL)
{
- return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
- apr_psprintf(r->pool,
- "Could not open the SVN "
- "filesystem at %s",
- fs_path));
+ serr = svn_repos_open(&(repos->repos), fs_path, r->connection->pool);
+ if (serr != NULL)
+ {
+ return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
+ apr_psprintf(r->pool,
+ "Could not open the SVN "
+ "filesystem at %s",
+ fs_path));
+ }
+
+ /* Cache the open repos for the next request on this connection */
+ apr_table_setn(r->connection->notes,
+ apr_pstrdup(r->connection->pool, repos_key),
+ (void *)repos->repos);
}
/* cache the filesystem object */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 2 01:27:13 2003