You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2003/05/29 19:52:22 UTC

dav memory scalability

So I'm jumping into issue 773, which is all about making mod_dav use
pools efficiently.  The theory is that at the moment, when it responds
to a depth-1 PROPFIND, it uses a single pool to walk over all the
children.  If a directory contains 1000 children, then this causes the
httpd process to use hundreds of megs of memory.  Poof, suddenly
nobody can checkout the large directory.

But I'm just not seeing this happen.  I'm doing some testing using svn
HEAD (r6090, 0.23+) and httpd-2.1 HEAD.

I create a repository with a single /trunk directory containing 1000
files.  When I do an 'svn co http://localhost/...', my httpd process
only grows to 23M, not 500M as the issue might suggest.  The *real*
problem seems to be the non-streamy 207 response; neon times out
waiting for 2-3 minutes unless you increase the timeout.

(There's still issue #1293, where Frank Hodum claims that his svn
client slowly leaks during large checkouts.  I've noticed this too;
when checking out 1000 files, my svn client slowly grew from 5M->11M,
seemingly without bound.  But it was very slow, and not
earth-shattering either.  And this is a separate bug in the svn client
anyway.)

So I'm bit skeptical at the moment.  It doesn't seem that mod_dav's
memory usage is a 3-alarm fire anymore.  In retrospect, almost every
complaint I've heard over the last few months is that "neon times out"
when waiting for a large directory to arrive.  

I'm not sure it's worth spending a few days changing mod_dav pool
usage, just to bring httpd from 22M down to 10M, or whatever.
Subversion users certainly won't notice the difference.  Instead, it
seems like I should be tackling the streaminess problem;  *that* would
be noticeable by everyone.

Thoughts?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: dav memory scalability

Posted by Ben Collins-Sussman <su...@collab.net>.
Brandon Ehle <az...@yahoo.com> writes:

> 1) Inside dav_method_propfind(), two different headers could possibly
> be sent depending on whether the ctx.propstat_404 bit gets set.
> [...]
> 2) dav_send_multistatus() needs to know which "xmlns:" attributes need
> to be set in the <D:multistatus> tag.  This would require making
> resource->hooks->walk() a two step process.  The first step would be
> required just to ask the provider for the namespaces that need to be
> added to the multistatus tag.  Then you could send the header and run
> resource->hooks->walk() to stream the data.

It sounds like there's exactly one problem... dav_send_multistatus()
optionally takes a list of namespaces to put in the <mulitstatus> tag,
and those namespaces may exist/vary based on the results of the walk.

Hmmm, maybe it's not necessary to worry about this at all.  Why not
just unconditionally add the extra doc->namespaces to the
<multistatus> tag?  Why is this code *only* doing so if a 404 came up
within the walk?  Does it hurt to always mention them?  Would it be
wrong?

Or... maybe somehow doc->namespaces gets modified during the walk?  It
which case, yeah, we'd need to harvest all namespaces first, before
doing the "real" walk.  

Let me investigate...

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: dav memory scalability

Posted by Brandon Ehle <az...@yahoo.com>.
Ben Collins-Sussman wrote:

>Justin Erenkrantz <ju...@erenkrantz.com> writes:
>
>  
>
>>Getting mod_dav to be streamy may be just as hard as getting the pool
>>usage right.  =)  But, perhaps not.  Let me know if you need any help.
>>    
>>
>
>Ugh, this looks really hard.
>
>dav_method_propfind has many call layers below it, and they *all*
>assume that the provider is writing into a text-buffer.  When control
>returns to the top level, it sends out the whole buffer.
>
>What we really want is for dav_method_propfind to look like
>dav_method_report: create an output filter, pass it down to the
>provider.  The provider creates a brigade and spews data into it.
>Voila, instant streaming.
>
>But this looks like a total rewrite of dav_method_propfind to me.  :-(
>
>  
>
I actually went and implemented bucket brigade streaming for this in the 
past while trying to reduce my httpd memory consumption, but I have no 
clue where my patches went to... 

It was pretty quick and easy to do, except for two issues that I ran 
into which made me drop the whole thing.  They shouldn't be too 
difficult to get around if you know the dav specs better than I do.

1) Inside dav_method_propfind(), two different headers could possibly be 
sent depending on whether the ctx.propstat_404 bit gets set.  Here's the 
comment by the piece of code in question in mod_dav.c line 1987:

    /* if a 404 was generated for an HREF, then we need to spit out the
     * doc's namespaces for use by the 404. Note that <response> elements
     * will override these ns0, ns1, etc, but NOT within the <response>
     * scope for the badprops. */

2) dav_send_multistatus() needs to know which "xmlns:" attributes need 
to be set in the <D:multistatus> tag.  This would require making 
resource->hooks->walk() a two step process.  The first step would be 
required just to ask the provider for the namespaces that need to be 
added to the multistatus tag.  Then you could send the header and run 
resource->hooks->walk() to stream the data.

BTW, Its been awhile since I did this, so I don't remember if this 100% 
correct.





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: dav memory scalability

Posted by Ben Collins-Sussman <su...@collab.net>.
Justin Erenkrantz <ju...@erenkrantz.com> writes:

> Getting mod_dav to be streamy may be just as hard as getting the pool
> usage right.  =)  But, perhaps not.  Let me know if you need any help.

Ugh, this looks really hard.

dav_method_propfind has many call layers below it, and they *all*
assume that the provider is writing into a text-buffer.  When control
returns to the top level, it sends out the whole buffer.

What we really want is for dav_method_propfind to look like
dav_method_report: create an output filter, pass it down to the
provider.  The provider creates a brigade and spews data into it.
Voila, instant streaming.

But this looks like a total rewrite of dav_method_propfind to me.  :-(


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: dav memory scalability

Posted by Robert Pluim <rp...@bigfoot.com>.
Justin Erenkrantz writes:
 > --On Thursday, May 29, 2003 2:52 PM -0500 Ben Collins-Sussman 
 > <su...@collab.net> wrote:
 > 
 > > So I'm bit skeptical at the moment.  It doesn't seem that mod_dav's
 > > memory usage is a 3-alarm fire anymore.  In retrospect, almost every
 > > complaint I've heard over the last few months is that "neon times out"
 > > when waiting for a large directory to arrive.
 > 
 > I believe the problem was that SVN clients weren't doing depth:1
 > PROPFINDs - that is a new change.  Instead we were doing a PROPFIND
 > for every file in a directory - I think that exacerbated the leak
 > in httpd as there is a per-request leakage.  And, I believe that
 > some patches have gone in recently to try to change how mod_dav_svn
 > used pools to help solve *some* of the problems.
 >

<URL:http://subversion.tigris.org/issues/show_bug.cgi?id=1179>

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: dav memory scalability

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
--On Thursday, May 29, 2003 2:52 PM -0500 Ben Collins-Sussman 
<su...@collab.net> wrote:

> So I'm bit skeptical at the moment.  It doesn't seem that mod_dav's
> memory usage is a 3-alarm fire anymore.  In retrospect, almost every
> complaint I've heard over the last few months is that "neon times out"
> when waiting for a large directory to arrive.

I believe the problem was that SVN clients weren't doing depth:1 PROPFINDs - 
that is a new change.  Instead we were doing a PROPFIND for every file in a 
directory - I think that exacerbated the leak in httpd as there is a 
per-request leakage.  And, I believe that some patches have gone in recently 
to try to change how mod_dav_svn used pools to help solve *some* of the 
problems.

Getting mod_dav to be streamy may be just as hard as getting the pool usage 
right.  =)  But, perhaps not.  Let me know if you need any help.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org