You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Kimdon <da...@kimdon.org> on 2003/11/04 21:13:41 UTC

Re: [RFC] : full-text instead of vdelta against empty bytestream

On Tue, Oct 21, 2003 at 09:47:19PM -0400, mark benedetto king wrote:
> I wish I could take credit for this idea, but Greg Hudson pointed out
> on IRC that we could store the youngest revisions of files as deltas
> against the empty bytestream.
> 
> Then there would be no CPU cost to the compression; it would be already
> done, and the one-time-per-commit cost amortized over the many checkouts.
> 
> I think this would also cut down repository size, since the fulltexts would
> not exist anywhere in the repository.  The smaller size could conceivably
> improve performance, since there would be fewer pages to read for certain
> operations, higher chance that any particular page would be in cache, etc.

I have now two different patches[1] to store the youngest revisions as
deltas against the empty bytestream.  

Approach 1: Do the youngest rev deltification inside
deltify_mutable(), that is when the rest of the deltification occurs.
This means the representation is first stored as fulltext, then later
compressed (deltified).

Approach 2: Never creates a fulltext, rather the youngest revision is
a delta against an empty byte stream from when that representation is
created (the beginning of that node revision's life) so nothing needs
to be done when the rest of the deltification occurs.  This one is
conceptually cleaner but my implementation currently has some rough
edges.

Approach 2 saves on disk space over the current full text storage.
Approach 1 does not, I think it has something to do with the way the
database works, the fulltext hangs out in the database file (though
not actually as part of the database, i.e. db_dump doesn't show the
fulltext strings, but a hexeditor does) for a revision or so after it
isn't needed (if anyone can explain that, I'm eager to know the
details).

Neither approach has a very negative effect on performance, but
neither approach has a very positive effect, a mixed bag in both
cases.

The next idea is to use the fact that we have deltified youngest
revisions to speed up checkout and export.  I have a broken (but
complete, maybe . . .) patch that does this, still working through the
details.

David

[1] : Neither of them are in a presentable form at present.

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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by "C. Michael Pilato" <cm...@collab.net>.
Greg Hudson <gh...@MIT.EDU> writes:

> On Tue, 2003-11-04 at 17:48, C. Michael Pilato wrote:
> > > That may be the reason, but I don't think it actually speeds up read
> > > operations to use a plain text.
> > 
> > Sorry, but I've read this three times, and I can't find an immediate
> > reason why this statement would be correct.  I can only assume that
> > you mean that in the overall cost of hitting the database, perhaps the
> > additional overhead of reading from a delta-versus-empty-file is lost
> > in the noise?
> 
> 1) As mbk points out, we'll be reading fewer blocks from the database. 
> Undeltification is cheap; disk I/O is expensive.
> 
> 2) If we're retrieving any revision other than the head revision, we
> already have to perform an undeltification operation.  I think "combine
> N deltas and apply the result to plaintext P" is probably about as slow
> as "combine N+1 deltas and apply the result to the empty string."
> 
> 3) If David succeeds in his work, we will save a deltification step for
> checkouts of the head, without having to sacrifice compression.  Since
> deltification is relatively expensive, and checkouts of the head are
> common in many contexts, that's a big win.
> 
> Actual measurements would be better than my speculations, of course.

Ah.  Now, see, that's the kinda data that makes an otherwise
unintuitive claim seem quite rational!  Thanks, Greg.

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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2003-11-04 at 17:48, C. Michael Pilato wrote:
> > That may be the reason, but I don't think it actually speeds up read
> > operations to use a plain text.
> 
> Sorry, but I've read this three times, and I can't find an immediate
> reason why this statement would be correct.  I can only assume that
> you mean that in the overall cost of hitting the database, perhaps the
> additional overhead of reading from a delta-versus-empty-file is lost
> in the noise?

1) As mbk points out, we'll be reading fewer blocks from the database. 
Undeltification is cheap; disk I/O is expensive.

2) If we're retrieving any revision other than the head revision, we
already have to perform an undeltification operation.  I think "combine
N deltas and apply the result to plaintext P" is probably about as slow
as "combine N+1 deltas and apply the result to the empty string."

3) If David succeeds in his work, we will save a deltification step for
checkouts of the head, without having to sacrifice compression.  Since
deltification is relatively expensive, and checkouts of the head are
common in many contexts, that's a big win.

Actual measurements would be better than my speculations, of course.


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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by "C. Michael Pilato" <cm...@collab.net>.
Greg Hudson <gh...@MIT.EDU> writes:

> On Tue, 2003-11-04 at 16:27, kfogel@collab.net wrote:
> > David Kimdon <da...@kimdon.org> writes:
> > > The next idea is to use the fact that we have deltified youngest
> > > revisions
> 
> > I thought we *don't* have deltified youngest revisions
> 
> We don't; the first part of his mail was about changing that.

I follow that.

> > and the reason we don't deltify them is precisely to speed up read
> > operations.
> 
> That may be the reason, but I don't think it actually speeds up read
> operations to use a plain text.

Sorry, but I've read this three times, and I can't find an immediate
reason why this statement would be correct.  I can only assume that
you mean that in the overall cost of hitting the database, perhaps the
additional overhead of reading from a delta-versus-empty-file is lost
in the noise?

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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by Greg Hudson <gh...@MIT.EDU>.
On Tue, 2003-11-04 at 16:27, kfogel@collab.net wrote:
> David Kimdon <da...@kimdon.org> writes:
> > The next idea is to use the fact that we have deltified youngest
> > revisions

> I thought we *don't* have deltified youngest revisions

We don't; the first part of his mail was about changing that.

> and the reason we don't deltify them is precisely to speed up read operations.

That may be the reason, but I don't think it actually speeds up read
operations to use a plain text.


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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by mark benedetto king <mb...@lowlatency.com>.
On Wed, Nov 05, 2003 at 12:22:20AM +0100, David Kimdon wrote:
> 
> Another theory is to keep the revisions in a form that is easily
> digestable by certain operations that we would like to speed up[1].
> The expectation is that other operations will not be inordinately

My theory is that disk is the slowest thing around, and that reading
50% fewer blocks off of disk is going to be roughly 50% faster.

If we get Daniel Berlin's delta routines in, the speedup would be
even more.


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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by David Kimdon <da...@kimdon.org>.
On Tue, Nov 04, 2003 at 03:27:06PM -0600, kfogel@collab.net wrote:
> David Kimdon <da...@kimdon.org> writes:
> > The next idea is to use the fact that we have deltified youngest
> > revisions to speed up checkout and export.  I have a broken (but
> > complete, maybe . . .) patch that does this, still working through the
> > details.
> 
> I thought we *don't* have deltified youngest revisions, 

true.

> and the reason
> we don't deltify them is precisely to speed up read operations.

That's the theory as I understand it as well.

> Am I missing something?

Another theory is to keep the revisions in a form that is easily
digestable by certain operations that we would like to speed up[1].
The expectation is that other operations will not be inordinately
slowed thanks to the delta combiner.  On checkout and export of head
(a fairly common operation?) or when a new file is added to update we
always create delta windows against an empty byte-stream.  That delta
takes a lot of CPU cycles to calculate.  If instead of needing to
create that textdelta we needed to only convert it from svndiff to
textdelta then CPU time spent on the server will be much less.


That's the theory anyway,

-David


[1] : I've also been toying with the idea of multiple representations
of the same node-revision.  This idea might be too much along the
lines of representation undeltification, i.e. not as much of a
performance enhancement as hoped for.  Anyway,  the fs can choose
which sub-representation it wants to use based on the operation
requested, consider for a given node:

- update from r3 to r10 - fs doesn't have that sub-representation, it
  calculates it and stores a new sub-representation, no speedup here

- update from r6 to r10 - fs calculated that yesterday, and saved the
  svndiff sub-representation, a bit of conversion (into textdelta
  format) and it is off to the consumer more quickly than if it needed
  to do the calculation from scratch
  
- checkout, export of any version - fs always keeps a
  sub-representation of the file against an empty-bytestream so this
  can be speedy too, but every version fulltext, ouch, that's a lot of
  space.
  
  etc.

In this case we are using more disk space and saving CPU time.  There
would need to be a process of pruning sub-representations that haven't
been used in a while to avoid repository bloat, or course.

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

Re: [RFC] : full-text instead of vdelta against empty bytestream

Posted by kf...@collab.net.
David Kimdon <da...@kimdon.org> writes:
> The next idea is to use the fact that we have deltified youngest
> revisions to speed up checkout and export.  I have a broken (but
> complete, maybe . . .) patch that does this, still working through the
> details.

I thought we *don't* have deltified youngest revisions, and the reason
we don't deltify them is precisely to speed up read operations.

Am I missing something?

-K


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