You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by Blair Zajac <bl...@orcaware.com> on 2010/11/10 05:02:58 UTC

Re: svn commit: r982355 - /subversion/branches/performance/subversion/svnserve/main.c

On Aug 4, 2010, at 11:43 AM, stefan2@apache.org wrote:

> Author: stefan2
> Date: Wed Aug  4 18:43:29 2010
> New Revision: 982355
> 
> URL: http://svn.apache.org/viewvc?rev=982355&view=rev
> Log:
> Fix an issue with fulltext caching already present in production SVN:
> APR pools often won't reuse memory fragments if they are larger
> than 80kB. Using string buffers while reconstructing fulltexts does 
> exactly The Bad Thing: request large buffers of various sizes that
> APR pools will often not reuse due to their differing and often just
> a tad bit too small size.
> 
> Use an allocator to limit the amount of unused memory fragments
> held by the root pools.
> 
> * subversion/svnserve/main.c
>  (main): limit the idle memory allocated per request root pool to 4 MB.
> 
> Modified:
>    subversion/branches/performance/subversion/svnserve/main.c
> 
> Modified: subversion/branches/performance/subversion/svnserve/main.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svnserve/main.c?rev=982355&r1=982354&r2=982355&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/svnserve/main.c (original)
> +++ subversion/branches/performance/subversion/svnserve/main.c Wed Aug  4 18:43:29 2010
> @@ -402,6 +402,7 @@ int main(int argc, const char *argv[])
>   apr_sockaddr_t *sa;
>   apr_pool_t *pool;
>   apr_pool_t *connection_pool;
> +  apr_allocator_t *allocator;
>   svn_error_t *err;
>   apr_getopt_t *os;
>   int opt;
> @@ -859,10 +860,22 @@ int main(int argc, const char *argv[])
>         return ERROR_SUCCESS;
> #endif
> 
> +      /* If we are using fulltext caches etc., we will allocate many large
> +         chunks of memory of various sizes outside the cachde for those
> +         fulltexts. Make sure, we use the memory wisely: use an allocator
> +         that causes memory fragments to be given back to the OS early. */
> +
> +      if (apr_allocator_create(&allocator))
> +        return EXIT_FAILURE;
> +
> +      apr_allocator_max_free_set(allocator, SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);

I'm just spamming this commit, but given svnserve is multithreaded, don't you need to register a mutex with the allocator?

Blair