You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Tobias Ringström <to...@ringstrom.mine.nu> on 2003/10/22 20:52:49 UTC

Link latency and ra_svn/ra_dav performance

The current implementation of both ra_svn and ra_dav are implemented 
without overlapping requests. In other words they always wait for the 
response from the server for the previous request before sending the 
next request. This is a huge performance problem over high latency 
links, but it is very noticable even over a fast LAN. This is an issue 
for both import/commit and export/co/update.

Fortunately for me, the ra_svn implementation was very easy to hack to 
demonstrate the possible performance gains. Using the attached patch, 
the svn protocol becomes much more streamy. I performed a checkout of a 
repository containing 138 small files (around 1 kiB average) over a 25 
ms (~1 Mb) ssh tunneled link. Before applying the patch above the 
checkout took 10 seconds. After applying the patch it takes 2 seconds, 
i.e. a five-fold improvement.

So what do you think? Can we make the protocols streamy? Should I create 
an issue?

/Tobias


Re: Link latency and ra_svn/ra_dav performance

Posted by Tobias Ringström <to...@ringstrom.mine.nu>.
mark benedetto king wrote:
> On Wed, Oct 22, 2003 at 05:41:04PM -0400, Greg Hudson wrote:
> 
>>The big question is, "how?"  I think it would be especially hard with
>>ra_dav, but just thinking about ra_svn, here are the options I see:
> 
> Without client-side threading (eek!) or, AFAICT, a significant neon API
> change, it would be very hard indeed for ra_dav.

I have not looked deeply into it, but we might be able to ditch 
ne_request_dispatch in favor of ne_begin_request et al to issue 
overlapping requests.  The goal is to begin a few requests even if we 
only read one result at a time.  Two outstanding requests would probably 
be enough for most links.

/Tobias


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

Re: Link latency and ra_svn/ra_dav performance

Posted by mark benedetto king <mb...@lowlatency.com>.
On Thu, Oct 23, 2003 at 03:01:25AM -0400, Greg Hudson wrote:
> On Wed, 2003-10-22 at 23:08, kfogel@collab.net wrote:
> > We haven't looked into pipelining & Neon much yet; the above is just
> > talk until we know more.
> 
> As Greg said, the current implementation of Neon doesn't support
> pipelining.  I just looked at the code to verify this;
> ne_begin_request() reads the response headers before returning control
> to the caller, and the code is very much not designed to handle multiple
> ne_begin_request()s before an ne_read_response_block().

Also, ra_dav itself would probably need some serious tweakage to
take advantage of the new API.

> 
> I think if we can get a significant checkout performance benefit by
> screwing caches, we should do so as a temporary measure.  We have no
> reports of anyone using HTTP caches as far as I know, and it makes no
> sense to massively penalize all of our users for the sake of none of our
> users.  Redesigning Neon or moving to a different client library is not
> a pre-1.0-sized task.

True.

> 
> I would even go so far as to say that we should temporarily screw the
> WebDAV protocol for commits and imports, and just send the edit over a
> custom report, if someone is willing to code that up.  (Are big imports
> all that frequent?  Not normally, but it's the first thing you do in
> many uses of Subversion, and up-front slowness is sometimes worse than
> frequent slowness.)
> 

Are there any real drawbacks to this other than that they'll distract us
from the maintainance/tuning of the core WebDAV operations?

--ben


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

Re: Link latency and ra_svn/ra_dav performance

Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2003-10-22 at 23:08, kfogel@collab.net wrote:
> We haven't looked into pipelining & Neon much yet; the above is just
> talk until we know more.

As Greg said, the current implementation of Neon doesn't support
pipelining.  I just looked at the code to verify this;
ne_begin_request() reads the response headers before returning control
to the caller, and the code is very much not designed to handle multiple
ne_begin_request()s before an ne_read_response_block().

I think if we can get a significant checkout performance benefit by
screwing caches, we should do so as a temporary measure.  We have no
reports of anyone using HTTP caches as far as I know, and it makes no
sense to massively penalize all of our users for the sake of none of our
users.  Redesigning Neon or moving to a different client library is not
a pre-1.0-sized task.

I would even go so far as to say that we should temporarily screw the
WebDAV protocol for commits and imports, and just send the edit over a
custom report, if someone is willing to code that up.  (Are big imports
all that frequent?  Not normally, but it's the first thing you do in
many uses of Subversion, and up-front slowness is sometimes worse than
frequent slowness.)


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

Re: Link latency and ra_svn/ra_dav performance

Posted by kf...@collab.net.
Greg Stein <gs...@lyra.org> writes:
> Are you talking about embedding the content within the REPORT? Which then
> implies that you're going to need to xml-escape or otherwise encode the
> binary content.
> 
> I don't really support this concept at all. By obviating the GET, you then
> toss the possibility of a caching proxy. It also moves us away from the
> proper solution...
> 
> ... which is to implement HTTP pipelining. That would let us jam a bunch
> of requests into the connection at once, thus reducing the round trip
> latency.
> 
> As mbk stated, pipelining would require a change to Neon, or to switch to a
> different client library.

I'm open to any solution that will work in a reasonable amount of
time, and am certainly not committed to an approach that hasn't even
really been tested experimentally yet.

That said, there is no way that we are going to take a huge up-front
perf hit in order to help out caching proxies.  Those would be
backwards priorities.  If the "obvious" solution turns out to have
negative effects on proxies, yet gets us (say) a 5x speedup on a
normal latency network, then screw the proxies.  I mean, sheesh :-).

We haven't looked into pipelining & Neon much yet; the above is just
talk until we know more.

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

Re: Link latency and ra_svn/ra_dav performance

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Oct 22, 2003 at 05:52:08PM -0500, kfogel@collab.net wrote:
> mark benedetto king <mb...@lowlatency.com> writes:
> > > The big question is, "how?"  I think it would be especially hard with
> > > ra_dav, but just thinking about ra_svn, here are the options I see:
> > 
> > Without client-side threading (eek!) or, AFAICT, a significant neon API
> > change, it would be very hard indeed for ra_dav.
> 
> Not necessarily.  Ben and I are meeting early tomorrow morning to try
> out a similar idea: make mod_dav_svn return a full tree delta (instead
> of a skelta) for a checkout request, instead of waiting for the
> zillions of GET requests from the client.

Are you talking about embedding the content within the REPORT? Which then
implies that you're going to need to xml-escape or otherwise encode the
binary content.

I don't really support this concept at all. By obviating the GET, you then
toss the possibility of a caching proxy. It also moves us away from the
proper solution...

... which is to implement HTTP pipelining. That would let us jam a bunch
of requests into the connection at once, thus reducing the round trip
latency.

As mbk stated, pipelining would require a change to Neon, or to switch to a
different client library.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

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

Re: Link latency and ra_svn/ra_dav performance

Posted by kf...@collab.net.
mark benedetto king <mb...@lowlatency.com> writes:
> > The big question is, "how?"  I think it would be especially hard with
> > ra_dav, but just thinking about ra_svn, here are the options I see:
> 
> Without client-side threading (eek!) or, AFAICT, a significant neon API
> change, it would be very hard indeed for ra_dav.

Not necessarily.  Ben and I are meeting early tomorrow morning to try
out a similar idea: make mod_dav_svn return a full tree delta (instead
of a skelta) for a checkout request, instead of waiting for the
zillions of GET requests from the client.


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

Re: Link latency and ra_svn/ra_dav performance

Posted by mark benedetto king <mb...@lowlatency.com>.
On Wed, Oct 22, 2003 at 05:41:04PM -0400, Greg Hudson wrote:
> 
> The big question is, "how?"  I think it would be especially hard with
> ra_dav, but just thinking about ra_svn, here are the options I see:
> 

Without client-side threading (eek!) or, AFAICT, a significant neon API
change, it would be very hard indeed for ra_dav.

--ben


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

Re: Link latency and ra_svn/ra_dav performance

Posted by mark benedetto king <mb...@lowlatency.com>.
On Wed, Oct 22, 2003 at 09:19:20PM -0400, Greg Hudson wrote:
> On Wed, 2003-10-22 at 19:43, Tobias Ringström wrote:
> > All of these suggestions are protocol changes
> 
> I can swing the protocol changes with a capability string.
> 
> > I don't think it's *too* hard to implement overlapping requests,
> > as in the following example.
> 
> > 1. send file 1
> > 2. send file 2
> > 3. read status (for file 1)
> 
> I have several concerns here:
> 
>   1. Is it too confusing, from an API perspective, to have a
> close_file() return an error for a *different* file?  I'm okay with
> deferring an file opreation error until close_edit() or close_dir(),
> because the file operation is contained within the directory or edit
> operation.  But I'm not sure about this sibling relationship.

Dunno.

> 
>   2. Is the implementation too ugly and error-prone?  It requires
> maintaining state in the edit baton and acting on it for every editor
> operation which can follow a close_file() or close_directory()
> operation.

Tricky, yes.

> 
>   3. Are we theoretically at risk of TCP deadlock?  The server could
> block trying to write a status while we block trying to write a file. 
> This seems unlikely given how little data the server is writing, but
> it's still not correct use of TCP.  For this reason, SMTP pipelining
> requires that clients use non-blocking writes, so that they can read
> some replies from the server and break the deadlock.

Yes, unless we do something like have the client buffer any sends
that would have blocked, so that it can continue executing until it
gets to a recv state.  This could potentially require a very large
buffer.

> 
>   4. How often is a send window of just two files enough to eliminate
> the latency problem?  It might be enough in almost all cases, but that
> seems like too much reliance on intuition.
> 

That's probably easier to measure than predict. :-)


--ben


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

Re: Link latency and ra_svn/ra_dav performance

Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2003-10-22 at 19:43, Tobias Ringström wrote:
> All of these suggestions are protocol changes

I can swing the protocol changes with a capability string.

> I don't think it's *too* hard to implement overlapping requests,
> as in the following example.

> 1. send file 1
> 2. send file 2
> 3. read status (for file 1)

I have several concerns here:

  1. Is it too confusing, from an API perspective, to have a
close_file() return an error for a *different* file?  I'm okay with
deferring an file opreation error until close_edit() or close_dir(),
because the file operation is contained within the directory or edit
operation.  But I'm not sure about this sibling relationship.

  2. Is the implementation too ugly and error-prone?  It requires
maintaining state in the edit baton and acting on it for every editor
operation which can follow a close_file() or close_directory()
operation.

  3. Are we theoretically at risk of TCP deadlock?  The server could
block trying to write a status while we block trying to write a file. 
This seems unlikely given how little data the server is writing, but
it's still not correct use of TCP.  For this reason, SMTP pipelining
requires that clients use non-blocking writes, so that they can read
some replies from the server and break the deadlock.

  4. How often is a send window of just two files enough to eliminate
the latency problem?  It might be enough in almost all cases, but that
seems like too much reliance on intuition.


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


Re: Link latency and ra_svn/ra_dav performance

Posted by Tobias Ringström <to...@ringstrom.mine.nu>.
Greg Hudson wrote:
> On Wed, 2003-10-22 at 16:52, Tobias Ringström wrote:
> 
>>The current implementation of both ra_svn and ra_dav are implemented 
>>without overlapping requests. In other words they always wait for the 
>>response from the server for the previous request before sending the 
>>next request.
> 
> That's not true; ra_svn defers the responses to many requests in order
> to reduce the round trip count.

True. The remaining culprits are close-file and close-dir.

>>So what do you think? Can we make the protocols streamy? Should I create 
>>an issue?
> 
> The big question is, "how?"  I think it would be especially hard with
> ra_dav, but just thinking about ra_svn, here are the options I see:
> 
>   * Defer edit errors until close_edit().  This would destroy the
> property that commits fail before file data is transmitted, and would
> mean that if a big import fails close to the beginning, the client
> wouldn't find out until it has transmitted all the data.

This one would be simple to implement.

>   * Defer edit errors until close_dir().  This wouldn't make the
> protocol quite as streamy as you'd like, but would preserve the commit
> property and would reduce the number of round trips.  It would also mean
> that big imports would fail reasonably quickly after an error occurs.

This one feels like a half-hearted solution, and if you have lots of 
directories with few files in them you will be hurt by this.

>   * Add a new editor function called something like
> get_deferred_error(), which would be optional to implement (the default
> implementation returns SVN_NO_ERROR).  Defer ra_svn errors until
> close_edit or get_deferred_error time.  The driver then gets to decide
> how to trade off round trips versus failure latency.  commit might call
> get_deferred_error() just once before sending the postfix deltas; import
> might call it once per directory or something.

All of these suggestions are protocol changes, but it is possible to 
solve this without changing the protocol.  I don't think it's *too* hard 
to implement overlapping requests, as in the following example.

1. send file 1
2. send file 2
3. read status (for file 1)
4. send file 3
5. read status (for file 2)
6. etc.

The protocol will never be out of sync since all requests are serialized 
and we know what we have sent.  (Unless of course the status for file 1 
means that we may not send file 2.)

/Tobias


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

Re: Link latency and ra_svn/ra_dav performance

Posted by Tobias Ringström <to...@ringstrom.mine.nu>.
I forgot one interesting data point...

Tobias Ringström wrote:
> I made another test (as suggested by Greg on IRC) by checking out 
> subversion instead of my own little tree. Checking out a freshly import 
> subversion from the 0.31.0 tarball over a 2000 kilobit 16 ms (i.e. quite 
> *low* latency) link:
> 
>     svn before patch : 2m18.837s [latency limited]
>     svn after patch  : 0m54.240s [bandwidth limited]
>     cvs over ssh     : 0m32.551s [bandwidth limited]

    svn over ssh after patch : 0m38.327s [bandwidth limited]

ssh is configured to use compression in both cases. As you can see, we 
are not far behind CVS now...

/Tobias


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

Re: Link latency and ra_svn/ra_dav performance

Posted by Tobias Ringström <to...@ringstrom.mine.nu>.
I made another test (as suggested by Greg on IRC) by checking out 
subversion instead of my own little tree. Checking out a freshly import 
subversion from the 0.31.0 tarball over a 2000 kilobit 16 ms (i.e. quite 
*low* latency) link:

	svn before patch : 2m18.837s [latency limited]
	svn after patch  : 0m54.240s [bandwidth limited]
	cvs over ssh     : 0m32.551s [bandwidth limited]

The only reason CVS is faster here is because it transmits less and 
compresses better. I would need more bandwidth to be able to separate 
them properly.

I want to stress that the potential difference is *much* greater than 
the factor of 2.5 above. It all depends on the size of the files and the 
network latency and bandwidth.

This kind of performance gain is possible for both ra_svn and ra_dav.

/Tobias


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

Re: Link latency and ra_svn/ra_dav performance

Posted by Greg Hudson <gh...@MIT.EDU>.
On Wed, 2003-10-22 at 16:52, Tobias Ringström wrote:
> The current implementation of both ra_svn and ra_dav are implemented 
> without overlapping requests. In other words they always wait for the 
> response from the server for the previous request before sending the 
> next request.

That's not true; ra_svn defers the responses to many requests in order
to reduce the round trip count.

> So what do you think? Can we make the protocols streamy? Should I create 
> an issue?

The big question is, "how?"  I think it would be especially hard with
ra_dav, but just thinking about ra_svn, here are the options I see:

  * Defer edit errors until close_edit().  This would destroy the
property that commits fail before file data is transmitted, and would
mean that if a big import fails close to the beginning, the client
wouldn't find out until it has transmitted all the data.

  * Defer edit errors until close_dir().  This wouldn't make the
protocol quite as streamy as you'd like, but would preserve the commit
property and would reduce the number of round trips.  It would also mean
that big imports would fail reasonably quickly after an error occurs.

  * Add a new editor function called something like
get_deferred_error(), which would be optional to implement (the default
implementation returns SVN_NO_ERROR).  Defer ra_svn errors until
close_edit or get_deferred_error time.  The driver then gets to decide
how to trade off round trips versus failure latency.  commit might call
get_deferred_error() just once before sending the postfix deltas; import
might call it once per directory or something.


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