You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ashod Nakashian <as...@yahoo.com> on 2012/03/26 12:47:19 UTC
Re: Compressed Pristines (Call for Vote)
I don't know how I missed this mail, but I have. Thanks to Ivan for bringing it to my attention. Please see inline.
----- Original Message -----
> From: Branko Čibej <br...@e-reka.si>
> To: dev@subversion.apache.org
> Cc:
> Sent: Sunday, March 25, 2012 4:02 AM
> Subject: Re: Compressed Pristines (Design Doc)
>
> On 22.03.2012 17:01, Branko Čibej wrote:
>> On 22.03.2012 16:50, Daniel Shahaf wrote:
>>> Branko Čibej wrote on Thu, Mar 22, 2012 at 16:37:24 +0100:
>>>> It's called SQLite.
>>> Heh. I wondered whether I should mention that the server uses BDB to
>>> store pristine files. (yes, the situation there is different in
>>> several relevant ways)
>> To clarify: I'm /not/ advocating that we store each and every file into
>> an SQLite BLOB. Files larger than several block sizes would be better
>> off on disk as real files (the compressor can, e.g., buffer compressed
>> contents up to, say, 32k, and if they become larger, spill directly into
>> a file; otherwise, dump into a BLOB). If we don't care about shared
>> pristine store, we don't even need a separate database, these blobs can
>> go into wc.db (which, as Greg points out, also serves as an index).
>>
>
> Since we need a few datapoints, I made a quick test to see what kind of
> space savings we can get with SQLite. Note that I've not tried any
> auto-vacuum settings, because my test only does insertions.
>
> I used a checkout of the current HTTPD trunk for my data set, and
> compressed all pristines, then moved them into a SQLite database
> depending on size; first, all compressed files 8k or smaller, next, all
> compressed files 32k or smaller. Note that my script does not prune
> empty directories from the pristine fanout. Here's the log:
>
> brane@zulu:~/src/httpd$ svn co http://svn.apache.org/repos/asf/httpd/httpd/trunk
> [...]
> U trunk
> Checked out revision 1305001.
> brane@zulu:~/src/httpd$ find trunk/.svn/pristine -type f | wc -l
> 3114
> brane@zulu:~/src/httpd$ du -sh trunk/.svn/pristine/
> 42M trunk/.svn/pristine/
> time gzip `find ./trunk/.svn/pristine -name '*.svn-base'`
>
> real 0m14.569s
> user 0m1.282s
> sys 0m0.747s
> brane@zulu:~/src/httpd$ du -sh trunk/.svn/pristine/
> 17M trunk/.svn/pristine/
> brane@zulu:~/src/httpd$ find trunk/.svn/pristine -size -8k -type f | wc -l
> 2856
> #
> # N.B.: 8k max size per blob
> #
> brane@zulu:~/src/httpd$ time python pristine.py trunk/.svn/pristine/
>
> real 0m29.683s
> user 0m0.533s
> sys 0m1.641s
> brane@zulu:~/src/httpd$ du -sh trunk/.svn/pristine/
> 4.7M trunk/.svn/pristine/
> brane@zulu:~/src/httpd$ ll trunk/.svn/pristine//pristine.db
> -rw-r--r-- 1 brane staff 322560 Mar 25 12:43 ps/pristine.db
> #
> # N.B.: 32k max size per blob
> #
> brane@zulu:~/src/httpd$ time python pristine.py trunk/.svn/pristine/
>
> real 0m23.831s
> user 0m0.529s
> sys 0m1.616s
> brane@zulu:~/src/httpd$ du -sh trunk/.svn/pristine/
> 1.2M trunk/.svn/pristine/
>
>
> The pristine.py script is attached.
>
> Based on these observations, it's clear that the implementation should
> proceed as follows:
>
> Step 1: Just compress the pristine files, do not use any packing. This
> gives a 60% decrease in disk usage in the HTTPD case, but even if the
> decrease is only 30%, it's still worth the effort.
>
> Step 2: Store small (for some definition of "small") compressed
> pristine
> files in a SQLite database. In the case of HTTPD, this gives an exter up
> to 90% savings in disk usage, but this is a very specific test case and
> it's hard to guess what kind of gain we'd get on average.
>
> All in all, looking at these number, there's a /looong/ way to go before
> we start playing with custom pack formats and compression of packed
> similar files. I'm not at all sure we'll ever really need the potential
> space savings of these methods, especially compared to the obvious risk
> to WC stability that writing and testing such code obviously brings.
Please see the numbers based on my simulation. I haven't ran HTTPD, but I suspect it'll yield results similar to that of SVN trunk. The simulation shows what gains there are if we use a custom pack file, as opposed to other approaches. The purpose is to avoid stipulation and have concrete figures. As such, and with this advantage at hand, I propose we make a final decision. There is no reason to implement in-place compression for "a while" and then move to packed files (similar to Git's experience) when we know before hand if it'd be worthwhile to pack or not. I don't mind implementing things in stages and with good testing at the end of each, but I'd be less inclined to release such intermediate stages to the public and similarly I'd be less encouraged to re-implement later to improve things when we can decide now with the same confidence as any other time, given the data we've already collected. If packing doesn't yield enough savings to warrant it,
then let's abandon it and never look back.
As such, I'd like to ask you to review your conclusion based on the following numbers. In particular, I'd like to point your attention at the larger projects (GCC, WebKit and OO) where the number of small files is truly large and will make wc.db rather large and bloated (actually, average file-size in the simulated projects is less than 8KB with the exception of SVN. GCC is less than 2KB after compression!). I don't know how typical these projects are.
Finally, I'd like to call on the community to vote on a design. It's a topic that has been discussed on and off for almost a decade. There is no doubt that it's a feature many look forward to, but we should not over design it and bloat our codebase. Having said that, I think it's fair to say we have much more information and data at this point to make a very educated judgment, if I may say so myself. Branko's sqlite python script combined with my bash simulation can really create something very close to a real implementation with mix-n-match of the schemes suggested and discussed.
*Let's vote on a design and a plan to get us there.* At this point I can only wait for everyone to catch up, do their tests and run their numbers and vote on what they think will best benefit the community in the long run.
::Subversion Compressed Pristines Simulation::
Disk block-size is 4096 bytes.
Checking out http://svn.apache.org/repos/asf/subversion/trunk/
svn: .svn-base is 44730415 bytes in 1882 files, 23767 average file size. Sub-block waste 3942353 (8.81%)
svn: .svn-base.GZ is 16044735 bytes in 1882 files, 8525 average gz file size. Sub-block waste 4644161 (28.94%)
svn: .svn-base.BZ2 is 15146221 bytes in 1882 files, 8047 average bzip2 file size. Sub-block waste 4563731 (30.13%)
svn: .svn-base.GZ saves 27983872 bytes, .svn-base.BZ2 saves 28962816 bytes (57.49% and 59.50%) respectively.
svn: .svn-base is 48672768 bytes on disk, .svn-base.GZ is 20688896 bytes on disk, .svn-text.BZ2 is 19709952 bytes on disk.
svn:
GZ Pack is 14295040 bytes on disk, BZ2 Pack is 13062144 bytes on disk.
Saved 34377728 and 35610624 bytes (70.63% and 73.16%) respectively.
svn: GZ pack saves 6393856 bytes (69.09%) compared to .svn-base.GZ.
svn: BZ2 pack saves 6647808 bytes (66.27%) compared to .svn-base.BZ2.
svn:
GZ Sorted Pack is 13832192 bytes on disk, BZ2 Sorted Pack is 12128256
bytes on disk. Saved 34840576 and 36544512 bytes (71.58% and 75.08%)
respectively.
svn: pristine files: 48672768 bytes on disk.
svn: in-place gz: 20688896 bytes (42.50% of original)
svn: in-place bz2: 19709952 bytes (40.49% of original)
svn: packed gz: 14295040 bytes (29.36% of original)
svn: packed bz2: 13062144 bytes (26.83% of original)
svn: sorted packed gz: 13832192 bytes (28.41% of original)
svn: sorted packed bz2: 12128256 bytes (24.91% of original)
Checking out svn://gcc.gnu.org/svn/gcc/trunk
gcc: .svn-base is 444058945 bytes in 75223 files, 5903 average file size. Sub-block waste 217023167 (48.87%)
gcc: .svn-base.GZ is 137009307 bytes in 75223 files, 1821 average gz file size. Sub-block waste 247084901 (180.34%)
gcc: .svn-base.BZ2 is 127560017 bytes in 75223 files, 1695 average bzip2 file size. Sub-block waste 246343343 (193.11%)
gcc: .svn-base.GZ saves 276987904 bytes, .svn-base.BZ2 saves 287178752 bytes (41.89% and 43.44%) respectively.
gcc: .svn-base is 661082112 bytes on disk, .svn-base.GZ is 384094208 bytes on disk, .svn-text.BZ2 is 373903360 bytes on disk.
gcc:
GZ Pack is 109268992 bytes on disk, BZ2 Pack is 91897856 bytes on disk.
Saved 551813120 and 569184256 bytes (83.47% and 86.09%) respectively.
gcc: GZ pack saves 274825216 bytes (28.44%) compared to .svn-base.GZ.
gcc: BZ2 pack saves 282005504 bytes (24.57%) compared to .svn-base.BZ2.
gcc:
GZ Sorted Pack is 94666752 bytes on disk, BZ2 Sorted Pack is 73170944
bytes on disk. Saved 566415360 and 587911168 bytes (85.68% and 88.93%)
respectively.
gcc: pristine files: 661082112 bytes on disk.
gcc: in-place gz: 384094208 bytes (58.10% of original)
gcc: in-place bz2: 373903360 bytes (56.55% of original)
gcc: packed gz: 109268992 bytes (16.52% of original)
gcc: packed bz2: 91897856 bytes (13.90% of original)
gcc: sorted packed gz: 94666752 bytes (14.31% of original)
gcc: sorted packed bz2: 73170944 bytes (11.06% of original)
Checking out http://svn.webkit.org/repository/webkit/trunk
webkit: .svn-base is 1752698337 bytes in 153298 files, 11433 average file size. Sub-block waste 385610271 (22.00%)
webkit: .svn-base.GZ is 1142138194 bytes in 153298 files, 7450 average gz file size. Sub-block waste 456489646 (39.96%)
webkit: .svn-base.BZ2 is 1159101266 bytes in 153298 files, 7561 average bzip2 file size. Sub-block waste 455017646 (39.25%)
webkit: .svn-base.GZ saves 539680768 bytes, .svn-base.BZ2 saves 524189696 bytes (25.23% and 24.51%) respectively.
webkit:
.svn-base is 2138308608 bytes on disk, .svn-base.GZ is 1598627840 bytes
on disk, .svn-text.BZ2 is 1614118912 bytes on disk.
webkit:
GZ Pack is 1112465408 bytes on disk, BZ2 Pack is 1098600448 bytes on
disk. Saved 1025843200 and 1039708160 bytes (47.97% and 48.62%)
respectively.
webkit: GZ pack saves 486162432 bytes (69.58%) compared to .svn-base.GZ.
webkit: BZ2 pack saves 515518464 bytes (68.06%) compared to .svn-base.BZ2.
webkit:
GZ Sorted Pack is 1178726400 bytes on disk, BZ2 Sorted Pack is
1093103616 bytes on disk. Saved 959582208 and 1045204992 bytes (44.87%
and 48.87%) respectively.
webkit: pristine files: 2138308608 bytes on disk.
webkit: in-place gz: 1598627840 bytes (74.76% of original)
webkit: in-place bz2: 1614118912 bytes (75.48% of original)
webkit: packed gz: 1112465408 bytes (52.02% of original)
webkit: packed bz2: 1098600448 bytes (51.37% of original)
webkit: sorted packed gz: 1178726400 bytes (55.12% of original)
webkit: sorted packed bz2: 1093103616 bytes (51.12% of original)
Checking out https://svn.apache.org/repos/asf/incubator/ooo/trunk
svn: E175002: REPORT of '/repos/asf/!svn/me': Could not read response body: Secure connection truncated (https://svn.apache.org)
ooo: .svn-base is 963601263 bytes in 61880 files, 15572 average file size. Sub-block waste 144469137 (14.99%)
ooo: .svn-base.GZ is 458977742 bytes in 61880 files, 7417 average gz file size. Sub-block waste 172936754 (37.67%)
ooo: .svn-base.BZ2 is 457007742 bytes in 61880 files, 7385 average bzip2 file size. Sub-block waste 170614146 (37.33%)
ooo: .svn-base.GZ saves 476155904 bytes, .svn-base.BZ2 saves 480448512 bytes (42.97% and 43.35%) respectively.
ooo: .svn-base is 1108070400 bytes on disk, .svn-base.GZ is 631914496 bytes on disk, .svn-text.BZ2 is 627621888 bytes on disk.
ooo:
GZ Pack is 429735936 bytes on disk, BZ2 Pack is 418869248 bytes on
disk. Saved 678334464 and 689201152 bytes (61.21% and 62.19%)
respectively.
ooo: GZ pack saves 202178560 bytes (68.00%) compared to .svn-base.GZ.
ooo: BZ2 pack saves 208752640 bytes (66.73%) compared to .svn-base.BZ2.
ooo:
GZ Sorted Pack is 413577216 bytes on disk, BZ2 Sorted Pack is 381874176
bytes on disk. Saved 694493184 and 726196224 bytes (62.67% and 65.53%)
respectively.
ooo: pristine files: 1108070400 bytes on disk.
ooo: in-place gz: 631914496 bytes (57.02% of original)
ooo: in-place bz2: 627621888 bytes (56.64% of original)
ooo: packed gz: 429735936 bytes (38.78% of original)
ooo: packed bz2: 418869248 bytes (37.80% of original)
ooo: sorted packed gz: 413577216 bytes (37.32% of original)
ooo: sorted packed bz2: 381874176 bytes (34.46% of original)
Checking out http://core.svn.wordpress.org/trunk/
wo: .svn-base is 11802194 bytes in 957 files, 12332 average file size. Sub-block waste 2341294 (19.83%)
wo: .svn-base.GZ is 5203459 bytes in 957 files, 5437 average gz file size. Sub-block waste 2542077 (48.85%)
wo: .svn-base.BZ2 is 5122614 bytes in 957 files, 5352 average bzip2 file size. Sub-block waste 2512330 (49.04%)
wo: .svn-base.GZ saves 6397952 bytes, .svn-base.BZ2 saves 6508544 bytes (45.23% and 46.01%) respectively.
wo: .svn-base is 14143488 bytes on disk, .svn-base.GZ is 7745536 bytes on disk, .svn-text.BZ2 is 7634944 bytes on disk.
wo:
GZ Pack is 4124672 bytes on disk, BZ2 Pack is 3801088 bytes on disk.
Saved 10018816 and 10342400 bytes (70.83% and 73.12%) respectively.
wo: GZ pack saves 3620864 bytes (53.25%) compared to .svn-base.GZ.
wo: BZ2 pack saves 3833856 bytes (49.78%) compared to .svn-base.BZ2.
wo:
GZ Sorted Pack is 3842048 bytes on disk, BZ2 Sorted Pack is 3493888
bytes on disk. Saved 10301440 and 10649600 bytes (72.83% and 75.29%)
respectively.
wo: pristine files: 14143488 bytes on disk.
wo: in-place gz: 7745536 bytes (54.76% of original)
wo: in-place bz2: 7634944 bytes (53.98% of original)
wo: packed gz: 4124672 bytes (29.16% of original)
wo: packed bz2: 3801088 bytes (26.87% of original)
wo: sorted packed gz: 3842048 bytes (27.16% of original)
wo: sorted packed bz2: 3493888 bytes (24.70% of original)
Cheers,
Ash
>
> Anyway, it's certain that creating this packed format is /not/ the first
> step to take.
>
> -- Brane
>
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
Ashod Nakashian wrote on Wed, Apr 04, 2012 at 11:57:45 -0700:
> I think we either agree that SVN should improve its footprint or we
> don't.
I agree with making svn_wc__pristine_*() smarter and I disagree with
teaching svn the proper mount(8) flags for all platforms APR supports.
Daniel
(than ks for your mail, btw. I read all of it, even though I snipped heavily)
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
----- Original Message -----
> From: Daniel Shahaf <da...@elego.de>
> To: Ashod Nakashian <as...@yahoo.com>
> Cc: Markus Schaber <m....@3s-software.com>; "julianfoad@btopenworld.com" <ju...@btopenworld.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
> Sent: Wednesday, April 4, 2012 10:29 PM
> Subject: Re: Compressed Pristines (Summary)
>
> Ashod Nakashian wrote on Wed, Apr 04, 2012 at 10:18:47 -0700:
>> >________________________________
>> > From: Daniel Shahaf <da...@elego.de>
>> >To: Ashod Nakashian <as...@yahoo.com>
>> >Cc: Markus Schaber <m....@3s-software.com>;
> "julianfoad@btopenworld.com" <ju...@btopenworld.com>;
> "mtherieau@gmail.com" <mt...@gmail.com>; Subversion
> Development <de...@subversion.apache.org>
>> >Sent: Wednesday, April 4, 2012 9:46 AM
>> >Subject: Re: Compressed Pristines (Summary)
>> >
>> >> >1. Filesystem compression.
>> >> >
>> >> >Would you like to assess the feasibility of compressing the
> pristine
>> >> >store by re-mounting the "pristines" subdirectory as
> a compressed
>> >> >subtree in the operating system's file system?
>> >>
>> >> No :-)
>> >>
>> >> There are two ways to answer this interesting proposition of
>> >> compressed file-systems. The obvious one is that it isn't
> something
>> >> SVN can or should control. The file-system and certainly system
>> >> drivers are up to the user and any requirement or suggestion of
>> >> tempering with them is decidedly unwarranted and unexpected from
>> >> a VCS.
>> >
>> >The suggestion wasn't that you teach svn how to change the OS's
> fs
>> >settinsg, it was that you investigate how solutions at the OS level
>> >compare to the other approaches already suggested (custom format -based
>> >and sqlite-based pristine store).
>>
>> That's an easy question. The answer is that at *best* they'll do as
>> good as in-place compression. However, in practice they'll do much
>> worse. The reason is that the OS level compression works on not only
>
> Is it _necessarily_ that way? What does Subversion about the pristine
> store's contents know that the filesystem doesn't?
No, not unless an OS cares about high performance that is independent of file-size. It's reasonable or an OS to assume random file access for both reading and writing. Recompressing the complete file on each write is not feasible, so whole files aren't compressed by OS compression. Furthermore, they use "real time" compression algorithms that are not very efficient, but are very fast and have low memory footprint.
Subvesion *knows* that pristine files are *never* modified, they are always replaced. (Note for the technically-correct: SVN might get a diff on the wire to update a prisine file, but as far as we care, the file must be completely read/parsed/patched/updated, so in the end, the whole file is streamed back to disk, not an arbitrary chunk, although for binary files this might not be the case. Still, even in that case we can use chunking to limit the largest number of bytes that must be recompressed, so large files can still be partially updated without major overheads.)
>
>> the single file level, but actually at the block level. This is to
>> make modifications reasonably fast (read compressed data, uncompress,
>> modify, write recompressed data). If the complete file is compressed
>> then even changing a single byte (neglecting that no storage works on
>> the byte-level anyway) will yield performance that will at least
>> linearly degrade by the filesize.
>>
>>
>> >
>> >In short: if 'mount -o compress=yes' provides 90% space savings
> then we
>> >would have little reason to implement space-saving solutions in svn
> itself.
>> >But it's the user's, not svn's, responsibility to run that.
>>
>>
>> I should kindly disagree here. The user can do that any time, anyway.
>> SVN is trying to improve its pristine store design,
>
> No we don't. We're trying to provide users with a low-footprint
> pristine store. If we can achieve that by tuning OS settings we
> might not need to write code.
As pointed out already, that's not portable, reasonable to expect of a VCS, achievable for all uses (due to permissions for example) or enforceable (for a unified experience).
>
>> not advise users
>> on how best to organize their storage (in general or when using SVN).
>> In addition, I find discriminating against users who don't have that
>> luxury or knowledge to be a bit unfair. At least if are claiming to
>> support the wide range of systems that we do.
>>
>
> Yes, I edited that out of my previous email: we should ensure that
> "low-footprint pristine store" is achievable on most/all platforms we
> support.
>
> Also, agreed that we should consider the case of users don't have
> permissions to tune their OS settings but have working copies.
I've just repeated this much a few lines above. I think we either agree that SVN should improve its footprint or we don't. If we do, then we need a built-in solution. If we don't, then whether the user is smart enough to use some trick or not becomes irrelevant; we can't force them either way.
>
>> -Ash
>>
>>
>> >
>
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
Ashod Nakashian wrote on Wed, Apr 04, 2012 at 10:18:47 -0700:
> >________________________________
> > From: Daniel Shahaf <da...@elego.de>
> >To: Ashod Nakashian <as...@yahoo.com>
> >Cc: Markus Schaber <m....@3s-software.com>; "julianfoad@btopenworld.com" <ju...@btopenworld.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
> >Sent: Wednesday, April 4, 2012 9:46 AM
> >Subject: Re: Compressed Pristines (Summary)
> >
> >> >1. Filesystem compression.
> >> >
> >> >Would you like to assess the feasibility of compressing the pristine
> >> >store by re-mounting the "pristines" subdirectory as a compressed
> >> >subtree in the operating system's file system?
> >>
> >> No :-)
> >>
> >> There are two ways to answer this interesting proposition of
> >> compressed file-systems. The obvious one is that it isn't something
> >> SVN can or should control. The file-system and certainly system
> >> drivers are up to the user and any requirement or suggestion of
> >> tempering with them is decidedly unwarranted and unexpected from
> >> a VCS.
> >
> >The suggestion wasn't that you teach svn how to change the OS's fs
> >settinsg, it was that you investigate how solutions at the OS level
> >compare to the other approaches already suggested (custom format -based
> >and sqlite-based pristine store).
>
> That's an easy question. The answer is that at *best* they'll do as
> good as in-place compression. However, in practice they'll do much
> worse. The reason is that the OS level compression works on not only
Is it _necessarily_ that way? What does Subversion about the pristine
store's contents know that the filesystem doesn't?
> the single file level, but actually at the block level. This is to
> make modifications reasonably fast (read compressed data, uncompress,
> modify, write recompressed data). If the complete file is compressed
> then even changing a single byte (neglecting that no storage works on
> the byte-level anyway) will yield performance that will at least
> linearly degrade by the filesize.
>
>
> >
> >In short: if 'mount -o compress=yes' provides 90% space savings then we
> >would have little reason to implement space-saving solutions in svn itself.
> >But it's the user's, not svn's, responsibility to run that.
>
>
> I should kindly disagree here. The user can do that any time, anyway.
> SVN is trying to improve its pristine store design,
No we don't. We're trying to provide users with a low-footprint
pristine store. If we can achieve that by tuning OS settings we
might not need to write code.
> not advise users
> on how best to organize their storage (in general or when using SVN).
> In addition, I find discriminating against users who don't have that
> luxury or knowledge to be a bit unfair. At least if are claiming to
> support the wide range of systems that we do.
>
Yes, I edited that out of my previous email: we should ensure that
"low-footprint pristine store" is achievable on most/all platforms we
support.
Also, agreed that we should consider the case of users don't have
permissions to tune their OS settings but have working copies.
> -Ash
>
>
> >
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
+1 to what Greg just outlined
Ashod Nakashian wrote on Wed, Apr 04, 2012 at 13:28:06 -0700:
> >________________________________
> > From: Greg Stein <gs...@gmail.com>
> >My vote is compress for files > N bytes (and store on disk), and stick the others into a new pristine.db. Maybe compress before inserting into Sqlite. Not sure. Add a few heuristics for skipping compression on certain files types.
> >Shouldn't be too bad to start with that.
> >Cheers,
> >-g
> >
>
> I feel this is indeed what we're closing on, at least for an initial working demo. But I'd like to hear more agreements before committing to this path. I know some did show support for this approach, but it's hard to track them in the noise.
>
> So to make it easier, let's either voice support to this suggestion and commit to an implementation, or voice objection with at least reasons and possibly alternative action. Silence is passive agreement, so the onus on those opposing ;-)
>
> Thanks to all!
> -Ash
>
Re: Compressed Pristines (Summary)
Posted by "C. Michael Pilato" <cm...@collab.net>.
On 04/04/2012 02:46 PM, Daniel Shahaf wrote:
> But one _could_ write a filesystem that implements compression and/or
> deduplication aimed at .svn/pristine/'s workflow. Should effort be
> spent there rather than on implementing a smarter svn_wc__pristine_*()?
>
> Daniel
> (devil's advocate mode)
"Get thee behind me!"
--
C. Michael Pilato <cm...@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand
Re: Compressed Pristines (Summary)
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Thu, Apr 5, 2012 at 11:24 AM, Branko Čibej <br...@apache.org> wrote:
> On 05.04.2012 17:35, Ashod Nakashian wrote:
>>> ________________________________
>>> From: Hyrum K Wright <hy...@wandisco.com>
>>>
>>> I'm glad we've found a way to relegate this problem to a "minor...technicality."
>> So far no objections then.
>>
>> What's the preferred mode of operation in such a case?
>>
>> I can update the proposal and start sending patches for the dev-list to review or I can work in a branch with post-commit reviews.
>
> I'd like to see this happen on trunk, with the whole compressed-pristine
> functionality wrapped in conditional-compilation blocks.
>
> However, there's likely to be a lot of churn and reviewing all those
> patches would never happen in real time. Therefore, I propose you do the
> work on a branch, CTR of course. There should be no problem giving you
> branch commit access, IMO.
And you can speed up the process by filing a CLA, if you have not
already done so:
http://www.apache.org/licenses/icla.pdf
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: Compressed Pristines (Summary)
Posted by Branko Čibej <br...@apache.org>.
On 05.04.2012 17:35, Ashod Nakashian wrote:
>> ________________________________
>> From: Hyrum K Wright <hy...@wandisco.com>
>>
>> I'm glad we've found a way to relegate this problem to a "minor...technicality."
> So far no objections then.
>
> What's the preferred mode of operation in such a case?
>
> I can update the proposal and start sending patches for the dev-list to review or I can work in a branch with post-commit reviews.
I'd like to see this happen on trunk, with the whole compressed-pristine
functionality wrapped in conditional-compilation blocks.
However, there's likely to be a lot of churn and reviewing all those
patches would never happen in real time. Therefore, I propose you do the
work on a branch, CTR of course. There should be no problem giving you
branch commit access, IMO.
-- Brane
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
>________________________________
> From: Hyrum K Wright <hy...@wandisco.com>
>
>I'm glad we've found a way to relegate this problem to a "minor...technicality."
So far no objections then.
What's the preferred mode of operation in such a case?
I can update the proposal and start sending patches for the dev-list to review or I can work in a branch with post-commit reviews. Alternatively, I commit to a fork on a site that has online review support, presumably until we create a branch. I'm good with all options, although, obviously, I prefer to commit my changes in bite-size chunks on a branch.
-Ash
Re: Compressed Pristines (Summary)
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Thu, Apr 5, 2012 at 6:45 AM, Julian Foad <ju...@btopenworld.com> wrote:
> Daniel Shahaf wrote:
>> [Managing uncompressed copies of files] is certainly a -minor-
>> complication we'll have to deal with. It's just a technicality,
>
> That's great, because I believe that is the only significant issue that needs to be solved in order to get a simple compressed pristine store completely working to the point where it could be released.
Same here. As long as our APIs for interacting with some external
tools consist of "provide a valid filename" there will be some cost if
everything has to be decompressed / exported-from-SQLite before we can
use it. Admittedly, many users don't use external tools at all, but
the people who do probably rely upon them heavily.
I'm glad we've found a way to relegate this problem to a "minor...technicality."
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: Compressed Pristines (Summary)
Posted by Julian Foad <ju...@btopenworld.com>.
Daniel Shahaf wrote:
> I agree with making svn_wc__pristine_*() smarter and I disagree with
> teaching svn the proper mount(8) flags for all platforms APR supports.
Me too. (Note: I never said svn should mount filesystems, I just said it would be interesting to investigate.)
Ashod Nakashian wrote:
> Greg Stein wrote:
>> My vote is compress for files > N bytes (and store on disk), and stick
>> the others into a new pristine.db. [...]
>
> I feel this is indeed what we're closing on, at least for an initial working
> demo. But I'd like to hear more agreements [...]
I'm happy with that. Looking forward to it.
> [Managing uncompressed copies of files] is certainly a -minor-
> complication we'll have to deal with. It's just a technicality,
That's great, because I believe that is the only significant issue that needs to be solved in order to get a simple compressed pristine store completely working to the point where it could be released.
- Julian
RE: Compressed Pristines (Summary)
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: Ashod Nakashian [mailto:ashodnakashian@yahoo.com]
> Sent: woensdag 4 april 2012 13:28
> To: Greg Stein
> Cc: dev@subversion.apache.org
> Subject: Re: Compressed Pristines (Summary)
>
> >________________________________
> > From: Greg Stein <gs...@gmail.com>
> >My vote is compress for files > N bytes (and store on disk), and stick
the
> others into a new pristine.db. Maybe compress before inserting into
Sqlite.
> Not sure. Add a few heuristics for skipping compression on certain files
> types.
> >Shouldn't be too bad to start with that.
> >Cheers,
> >-g
> >
>
> I feel this is indeed what we're closing on, at least for an initial
working demo.
> But I'd like to hear more agreements before committing to this path. I
know
> some did show support for this approach, but it's hard to track them in
the
> noise.
>
> So to make it easier, let's either voice support to this suggestion and
commit
> to an implementation, or voice objection with at least reasons and
possibly
> alternative action. Silence is passive agreement, so the onus on those
> opposing ;-)
+1
The combination of some compression (gzip or plain deflate), maybe some
specific uncompressed files and the small files in SQLite sounds good.
I think the cutoff point for SQLite should be below what we can have in
memory as we can't keep database transactions open to back up streams. 32K
(and a few times higher) should be safe to read in memory at once.
Bert
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
Hi Justin,
Sorry for the late reply and thanks for your notes. I should say right off the bat that the design doc is outdated in terms of what we plan to do as a first implementation, although as a proposal for packed file format I think it's still mostly valid, except for a few notes and improvements (such as 64bit filesize) that are missing/invalid (regardless of whether or not we'll ultimately implement it or not).
See my notes and comments inline please.
>________________________________
> From: Justin Erenkrantz <ju...@erenkrantz.com>
>To: Ashod Nakashian <as...@yahoo.com>
>Cc: Greg Stein <gs...@gmail.com>; "dev@subversion.apache.org" <de...@subversion.apache.org>
>Sent: Friday, April 6, 2012 10:19 AM
>Subject: Re: Compressed Pristines (Summary)
>
>On Wed, Apr 4, 2012 at 1:28 PM, Ashod Nakashian
><as...@yahoo.com> wrote:
>> I feel this is indeed what we're closing on, at least for an initial working demo. But I'd like to hear more agreements before committing to this path. I know some did show support for this approach, but it's hard to track them in the noise.
>>
>> So to make it easier, let's either voice support to this suggestion and commit to an implementation, or voice objection with at least reasons and possibly alternative action. Silence is passive agreement, so the onus on those opposing ;-)
>
>I just read the Google doc - glad to see progress here - a few comments:
>
>First off, if I understand correctly, I do have to say that I'm not at
>all a fan of having a large pristine file spread out across multiple
>on-disk compressed pack files. I don't think that makes a whole lot
>of sense - I think it'd be simplest (when we hit the heuristic to put
>it on-disk rather than in SQLite) to keep it to just one file. I
>don't get why we'd want to have a big image pristine file (say a PSD
>file) split out into say 20 smaller files on disk. Why? It just
>seems we're going to introduce a lot of complexity for very little
>return.
The straightforward design is to have a single large pack file. But in practice this is very problematic. You can already find FSes that may barf on multi-GB files, but that aside, consider the overhead of removing prisitine files and shifting the bytes following it. The overhead is extreme. To avoid that, we need to track holes in the files (and incur the wasted space on disk) and (even worse) we need to do heavyweight lifting to accommodate new/modified pristines into these holes where they might not fit! In other words, we have to write a complex FS in a single file and we have to keep its size on disk small (to justify this feature!) and to do housekeeping as fast as possible (shifting GBs on disk because we have a largish hole at the beginning of the file has a cost).
My solution is to split the pack files such that each file is small enough to fit in memory and be written to disk in sub-second times. This way, 1) holes in these files can be avoided completely and swiftly, 2) even if we keep holes, they shouldn't/couldn't be too large.
> The whole point of stashing the small files directly into
>SQLite's pristine.db is to make the small files SQLite's problem and
>not the on-disk FS (and reduce sub-block issues) - with that in place,
>I think we're not going to need to throw multiple files into the same
>pack file. It'll just get too confusing, IMO, to keep track of which
>file offsets to use. (For a large file that already hits the size
>trigger, we know that - worst case scenario - we might lose one FS
>block. Yawn.) We can make the whole strategy simpler if we follow
>that.
I'm a bit confused here. You're assuming that we'll use Sqlite for small files and the FS for larger ones, I'm assuming. However that's not in the proposal, it's what we've agreed on on this list. We aren't going to implement both, not for now at least. What we're going to do is simply push small pristines into pristine.db and in-place compress the larger ones on disk (as a first implementation we'll probably even leave the names the same and change nothing other than passing the disk I/O through compressed streams). Beyond that, we will probably experiment with packing. But it's a bit soon to worry about it. Although any research or help is more than welcome!
>
>I'm with Greg in thinking that we don't need the pack index files -
>but, I think I'll go further and reiterate that I think that there
>should just be a 1:1 correspondence between the pack file and the
>pristine file. What's the real advantage of having multiple large
>pristines in one pack file (and that we constantly *append* to)? And,
>with append FS ops with multiple files in one pack file, we rely on
>our WC/FS locking strategy to be 100% perfect or we have a hosed pack
>file. Ugh. I think it just adds unnecessary complexity. I think
>it'll be far simpler to have 1:1 correspondence with a pack file to a
>single large pristine. We'll have enough complexity already to just
>find the small files sitting in SQLite rather than on-disk.
It's all relative! Saying "multiple large pristines in one pack file" assumes too much. I find it better to first define/find/compute an order of pack file size that satisfies our reqs (my crude math finds that to be in the order of a few MBs - see proposal doc) then it follows automatically the largest pristine that can share a pack file with another. Anything smaller can share a pack file with others, and hence (by our definition!) aren't "too large". Larger ones are "really large" (again by our definition) and so will be compressed alone on disk (ignoring if there will be a pack-header or not is hopefully not debated for now) - practically these files will be in-place compressed, as a result.
As for assuming that we only/constantly append to a pack file, that's unfounded. Files may be removed from a pristine store upon svn up. Even if not, a file modification is reasonably implemented as remove+add. This is the correct way to do it because the files size might change and we need to do the same housekeeping as removing one file and adding an unrelated one. Granted, there is room for improving this. In other words, knowing it's the same prisitine file modified a bit doesn't give us much information to be of practical use.
>
>Given that 1:1 correspondence, I do think that the original file-size
>and the complete checksum should be stored in the custom pack file
>on-disk. It'll make it so that we could easily validate whether the
>pack file is corrupt or not by using file-size (as a first-order
>check) and checksum (as second-order). The thinking here is that if
>the checksum is not in the file contents, but only in the file name
>(or the pristine.db), the file system could very easily lose the
>filename (hello ext3/4!) - this would allow us to verify the integrity
>of the pack file and reassociate it if it gets dis-associated. This
>is less of an issue with the client as it can always refetch - but, if
>the server code ends up using the same on-disk format (as hinted in
>the Google Doc)...then, I think this is important to have in the file
>format from the beginning.
>
>I definitely think that we should store the full 64-bit length
>svn_filesize_t and not be cute and assume no one has a file larger
>than 1TB.
All welcome notes. We will get back to these issues when we have a working version that we can play and experiment with. There is certainly too many things to worry about and perhaps even more tempting points to toy with. To be pragmatic (and productive) I want to focus on getting the simplest working implementation that can justify this feature (i.e. one that does produce real disk savings without too much complexity or performance reduction). But points taken.
>
>I'll disagree with Greg for now and say that it's probably best to
>just pack everything and not try to be cute about not packing certain
>file types - I think that's a premature optimization right now. I
>think the complexity of having a mixed pristine collection with some
>files packed and some files unpacked is odd (and some files in SQLite
>and some files on-disk). Maybe end up adding a no-op compression type
>to the file format (IOW, tell gzip to do a no-op inflate via
>Z_NO_COMPRESSION). Maybe. I just doubt it's worth the additional
>complexity though. ("Is this pristine file compressed?" "I don't
>know." Argh!) Making those assumptions based on file extensions or
>even magic bits can be a bit awkward - case in point is PDF...some
>times it'll compress well, some times it won't. So, best off just
>always compressing it. =)
Agreed. I think it's reasonable to attempt at a no-compression type, but keep it abstracted away in the compression layer, not higher. I also agree it's a premature optimization, so we should do it when we have a working stack first.
-Ash
>
>My $.02. -- justin
>
>
>
Re: Compressed Pristines (Summary)
Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Wed, Apr 4, 2012 at 1:28 PM, Ashod Nakashian
<as...@yahoo.com> wrote:
> I feel this is indeed what we're closing on, at least for an initial working demo. But I'd like to hear more agreements before committing to this path. I know some did show support for this approach, but it's hard to track them in the noise.
>
> So to make it easier, let's either voice support to this suggestion and commit to an implementation, or voice objection with at least reasons and possibly alternative action. Silence is passive agreement, so the onus on those opposing ;-)
I just read the Google doc - glad to see progress here - a few comments:
First off, if I understand correctly, I do have to say that I'm not at
all a fan of having a large pristine file spread out across multiple
on-disk compressed pack files. I don't think that makes a whole lot
of sense - I think it'd be simplest (when we hit the heuristic to put
it on-disk rather than in SQLite) to keep it to just one file. I
don't get why we'd want to have a big image pristine file (say a PSD
file) split out into say 20 smaller files on disk. Why? It just
seems we're going to introduce a lot of complexity for very little
return. The whole point of stashing the small files directly into
SQLite's pristine.db is to make the small files SQLite's problem and
not the on-disk FS (and reduce sub-block issues) - with that in place,
I think we're not going to need to throw multiple files into the same
pack file. It'll just get too confusing, IMO, to keep track of which
file offsets to use. (For a large file that already hits the size
trigger, we know that - worst case scenario - we might lose one FS
block. Yawn.) We can make the whole strategy simpler if we follow
that.
I'm with Greg in thinking that we don't need the pack index files -
but, I think I'll go further and reiterate that I think that there
should just be a 1:1 correspondence between the pack file and the
pristine file. What's the real advantage of having multiple large
pristines in one pack file (and that we constantly *append* to)? And,
with append FS ops with multiple files in one pack file, we rely on
our WC/FS locking strategy to be 100% perfect or we have a hosed pack
file. Ugh. I think it just adds unnecessary complexity. I think
it'll be far simpler to have 1:1 correspondence with a pack file to a
single large pristine. We'll have enough complexity already to just
find the small files sitting in SQLite rather than on-disk.
Given that 1:1 correspondence, I do think that the original file-size
and the complete checksum should be stored in the custom pack file
on-disk. It'll make it so that we could easily validate whether the
pack file is corrupt or not by using file-size (as a first-order
check) and checksum (as second-order). The thinking here is that if
the checksum is not in the file contents, but only in the file name
(or the pristine.db), the file system could very easily lose the
filename (hello ext3/4!) - this would allow us to verify the integrity
of the pack file and reassociate it if it gets dis-associated. This
is less of an issue with the client as it can always refetch - but, if
the server code ends up using the same on-disk format (as hinted in
the Google Doc)...then, I think this is important to have in the file
format from the beginning.
I definitely think that we should store the full 64-bit length
svn_filesize_t and not be cute and assume no one has a file larger
than 1TB.
I'll disagree with Greg for now and say that it's probably best to
just pack everything and not try to be cute about not packing certain
file types - I think that's a premature optimization right now. I
think the complexity of having a mixed pristine collection with some
files packed and some files unpacked is odd (and some files in SQLite
and some files on-disk). Maybe end up adding a no-op compression type
to the file format (IOW, tell gzip to do a no-op inflate via
Z_NO_COMPRESSION). Maybe. I just doubt it's worth the additional
complexity though. ("Is this pristine file compressed?" "I don't
know." Argh!) Making those assumptions based on file extensions or
even magic bits can be a bit awkward - case in point is PDF...some
times it'll compress well, some times it won't. So, best off just
always compressing it. =)
My $.02. -- justin
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
>________________________________
> From: Greg Stein <gs...@gmail.com>
>My vote is compress for files > N bytes (and store on disk), and stick the others into a new pristine.db. Maybe compress before inserting into Sqlite. Not sure. Add a few heuristics for skipping compression on certain files types.
>Shouldn't be too bad to start with that.
>Cheers,
>-g
>
I feel this is indeed what we're closing on, at least for an initial working demo. But I'd like to hear more agreements before committing to this path. I know some did show support for this approach, but it's hard to track them in the noise.
So to make it easier, let's either voice support to this suggestion and commit to an implementation, or voice objection with at least reasons and possibly alternative action. Silence is passive agreement, so the onus on those opposing ;-)
Thanks to all!
-Ash
Re: Compressed Pristines (Summary)
Posted by Ivan Zhakov <iv...@visualsvn.com>.
On Wed, Apr 4, 2012 at 23:54, Greg Stein <gs...@gmail.com> wrote:
>> >
>> >Daniel
>> >(devil's advocate mode)
>
> Given Daniel's devil's advocate position, I say just ignore him. Don't feed
> him :-)
>
> My vote is compress for files > N bytes (and store on disk), and stick the
> others into a new pristine.db. Maybe compress before inserting into Sqlite.
> Not sure. Add a few heuristics for skipping compression on certain files
> types.
>
> Shouldn't be too bad to start with that.
>
+1.
--
Ivan Zhakov
Re: Compressed Pristines (Summary)
Posted by Greg Stein <gs...@gmail.com>.
On Apr 4, 2012 3:26 PM, "Ashod Nakashian" <as...@yahoo.com> wrote:
>
>
>
>
> >________________________________
> > From: Daniel Shahaf <da...@elego.de>
>....
> >>
> >
> >But one _could_ write a filesystem that implements compression and/or
> >deduplication aimed at .svn/pristine/'s workflow. Should effort be
> >spent there rather than on implementing a smarter svn_wc__pristine_*()?
>
> Perhaps we should, but is that a
simpler/easier/more-maintainable/first-try approach that we can defend with
a straight face? I'm having a hard time doing that in my current mode.
>
> >
> >Daniel
> >(devil's advocate mode)
Given Daniel's devil's advocate position, I say just ignore him. Don't feed
him :-)
My vote is compress for files > N bytes (and store on disk), and stick the
others into a new pristine.db. Maybe compress before inserting into Sqlite.
Not sure. Add a few heuristics for skipping compression on certain files
types.
Shouldn't be too bad to start with that.
Cheers,
-g
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
>________________________________
> From: Daniel Shahaf <da...@elego.de>
>To: Ashod Nakashian <as...@yahoo.com>
>Cc: Julian Foad <ju...@btopenworld.com>; Markus Schaber <m....@3s-software.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
>Sent: Wednesday, April 4, 2012 10:46 PM
>Subject: Re: Compressed Pristines (Summary)
>
>Ashod Nakashian wrote on Wed, Apr 04, 2012 at 11:41:43 -0700:
>>
>>
>>
>>
>> ----- Original Message -----
>> > From: Julian Foad <ju...@btopenworld.com>
>> > To: Ashod Nakashian <as...@yahoo.com>
>> > Cc: Daniel Shahaf <da...@elego.de>; Markus Schaber <m....@3s-software.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
>> > Sent: Wednesday, April 4, 2012 9:45 PM
>> > Subject: Re: Compressed Pristines (Summary)
>> >
>> > Ashod Nakashian wrote:
>> >
>> >> Daniel Shahaf wrote:
>> >>>>> Would you like to assess the feasibility of compressing the
>> > pristine
>> >>>> >store by re-mounting the "pristines" subdirectory as
>> > a compressed
>> >>>> >subtree in the operating system's file system?
>> >>>>
>> >>>> No :-)
>> >>>>
>> >>>> There are two ways to answer this interesting proposition of
>> >>>> compressed file-systems. The obvious one is that it isn't
>> > something
>> >>>> SVN can or should control. The file-system and certainly system
>> >>>> drivers are up to the user and any requirement or suggestion of
>> >>>> tempering with them is decidedly unwarranted and unexpected from
>> >>>> a VCS.
>> >>>
>> >>> The suggestion wasn't that you teach svn how to change the OS's
>> > fs
>> >>> settinsg, it was that you investigate how solutions at the OS level
>> >>> compare to the other approaches already suggested (custom format -based
>> >>> and sqlite-based pristine store).
>> >
>> > Yes, Daniel, that's exactly what I meant. Sorry, Ash, for not being clear
>> > enough.
>> >
>> > Of course that's inherently a non-portable solution that may not be
>> > available on all platforms and certainly will differ. But that's
>> > somewhat analogous to support for password storage: in Windows land
>> > there's a standard way to do it, in Unixy lands you have to choose your
>> > favourite third-party subsystem and externally configure Gnome-keyring or
>> > KDE-wallet or whatever you chose. Of course there are other
>> > disadvantages too, I just think it would be interesting to compare the
>> > disadvantages with the advantages.
>> >
>> >> That's an easy question. The answer is that at *best* they'll do as
>> > good
>> >> as in-place compression. However, in practice they'll do much worse.
>> >
>> > Ash, what's your measure of "best" here -- just the compression
>> > ratio? What about other kinds of goodness such as the automatic recovering of
>> > free space, and the ability to present a plain-text view of the file content
>> > through the standard filesystem API which eliminates the need for us to
>> > implement a plain-text cache in Subversion?
>> >
>> >> The
>> >> reason is that the OS level compression works on not only the single file
>> > level,
>> >> but actually at the block level. This is to make modifications reasonably
>> > fast
>> >> (read compressed data, uncompress, modify, write recompressed data). If the
>> >
>> >> complete file is compressed then even changing a single byte (neglecting
>> > that no
>> >> storage works on the byte-level anyway) will yield performance that will at
>> >
>> >> least linearly degrade by the filesize.
>> >
>> > Changing a single byte is an irrelevant scenario, because pristine files are
>> > always created in full and then never modified.
>>
>> But the OS compression doesn't know that! It's design assumes average
>> file modification operations, and that's rarely replacing the full
>> file (which is the norm for us). I was only explaining and justifying
>> the design decision of OS level compression.
>>
>
>But one _could_ write a filesystem that implements compression and/or
>deduplication aimed at .svn/pristine/'s workflow. Should effort be
>spent there rather than on implementing a smarter svn_wc__pristine_*()?
Perhaps we should, but is that a simpler/easier/more-maintainable/first-try approach that we can defend with a straight face? I'm having a hard time doing that in my current mode.
>
>Daniel
>(devil's advocate mode)
>
>> >
>> >>> In short: if 'mount -o compress=yes' provides 90% space savings
>> > then
>> >> we
>> >>> would have little reason to implement space-saving solutions in svn
>> > itself.
>> >>> But it's the user's, not svn's, responsibility to run that.
>> >
>> > By the way, Daniel, I'm not ruling out the possibility that we may want to
>> > provide some glue logic so that Subversion can help the user to set up the
>> > feature. Without such assistance, only expert users would ever benefit.
>> >
>> > It's clearly an interesting topic!
>> >
>> > - Julian
>> >
>
>
>
Re: Compressed Pristines (Summary)
Posted by Branko Čibej <br...@apache.org>.
On 04.04.2012 20:46, Daniel Shahaf wrote:
> But one _could_ write a filesystem that implements compression and/or
> deduplication aimed at .svn/pristine/'s workflow. Should effort be
> spent there rather than on implementing a smarter svn_wc__pristine_*()?
Now that's an interesting idea. I propose that Ashod immediately drop
his pristine work and instead implement a proof-of-concept, portable
userspace compressed filesystem. I further suggest that the best test
case for the reference implementation might be pristine storage for
Subversion, and in order to lop a few man-years off the proof-of-concept
stage, he might use SQLite for storing filesystem metadata.
Oh wait ... :)
-- Brane
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
Ashod Nakashian wrote on Wed, Apr 04, 2012 at 11:41:43 -0700:
>
>
>
>
> ----- Original Message -----
> > From: Julian Foad <ju...@btopenworld.com>
> > To: Ashod Nakashian <as...@yahoo.com>
> > Cc: Daniel Shahaf <da...@elego.de>; Markus Schaber <m....@3s-software.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
> > Sent: Wednesday, April 4, 2012 9:45 PM
> > Subject: Re: Compressed Pristines (Summary)
> >
> > Ashod Nakashian wrote:
> >
> >> Daniel Shahaf wrote:
> >>>>> Would you like to assess the feasibility of compressing the
> > pristine
> >>>> >store by re-mounting the "pristines" subdirectory as
> > a compressed
> >>>> >subtree in the operating system's file system?
> >>>>
> >>>> No :-)
> >>>>
> >>>> There are two ways to answer this interesting proposition of
> >>>> compressed file-systems. The obvious one is that it isn't
> > something
> >>>> SVN can or should control. The file-system and certainly system
> >>>> drivers are up to the user and any requirement or suggestion of
> >>>> tempering with them is decidedly unwarranted and unexpected from
> >>>> a VCS.
> >>>
> >>> The suggestion wasn't that you teach svn how to change the OS's
> > fs
> >>> settinsg, it was that you investigate how solutions at the OS level
> >>> compare to the other approaches already suggested (custom format -based
> >>> and sqlite-based pristine store).
> >
> > Yes, Daniel, that's exactly what I meant. Sorry, Ash, for not being clear
> > enough.
> >
> > Of course that's inherently a non-portable solution that may not be
> > available on all platforms and certainly will differ. But that's
> > somewhat analogous to support for password storage: in Windows land
> > there's a standard way to do it, in Unixy lands you have to choose your
> > favourite third-party subsystem and externally configure Gnome-keyring or
> > KDE-wallet or whatever you chose. Of course there are other
> > disadvantages too, I just think it would be interesting to compare the
> > disadvantages with the advantages.
> >
> >> That's an easy question. The answer is that at *best* they'll do as
> > good
> >> as in-place compression. However, in practice they'll do much worse.
> >
> > Ash, what's your measure of "best" here -- just the compression
> > ratio? What about other kinds of goodness such as the automatic recovering of
> > free space, and the ability to present a plain-text view of the file content
> > through the standard filesystem API which eliminates the need for us to
> > implement a plain-text cache in Subversion?
> >
> >> The
> >> reason is that the OS level compression works on not only the single file
> > level,
> >> but actually at the block level. This is to make modifications reasonably
> > fast
> >> (read compressed data, uncompress, modify, write recompressed data). If the
> >
> >> complete file is compressed then even changing a single byte (neglecting
> > that no
> >> storage works on the byte-level anyway) will yield performance that will at
> >
> >> least linearly degrade by the filesize.
> >
> > Changing a single byte is an irrelevant scenario, because pristine files are
> > always created in full and then never modified.
>
> But the OS compression doesn't know that! It's design assumes average
> file modification operations, and that's rarely replacing the full
> file (which is the norm for us). I was only explaining and justifying
> the design decision of OS level compression.
>
But one _could_ write a filesystem that implements compression and/or
deduplication aimed at .svn/pristine/'s workflow. Should effort be
spent there rather than on implementing a smarter svn_wc__pristine_*()?
Daniel
(devil's advocate mode)
> >
> >>> In short: if 'mount -o compress=yes' provides 90% space savings
> > then
> >> we
> >>> would have little reason to implement space-saving solutions in svn
> > itself.
> >>> But it's the user's, not svn's, responsibility to run that.
> >
> > By the way, Daniel, I'm not ruling out the possibility that we may want to
> > provide some glue logic so that Subversion can help the user to set up the
> > feature. Without such assistance, only expert users would ever benefit.
> >
> > It's clearly an interesting topic!
> >
> > - Julian
> >
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
Julian Foad wrote on Wed, Apr 04, 2012 at 18:45:34 +0100:
> Ashod Nakashian wrote:
> > Daniel Shahaf wrote:
> >> In short: if 'mount -o compress=yes' provides 90% space savings
> >> then we would have little reason to implement space-saving
> >> solutions in svn itself. But it's the user's, not svn's,
> >> responsibility to run that.
>
> By the way, Daniel, I'm not ruling out the possibility that we may
> want to provide some glue logic so that Subversion can help the user
> to set up the feature. Without such assistance, only expert users
> would ever benefit.
>
What kind of logic do you have in mind? I imagine that any logic here
would need to run as root and be reasonably system- (and filesystem-)
specific.
> It's clearly an interesting topic!
>
Indeed.
> - Julian
Re: Compressed Pristines (Summary)
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Wed, Apr 4, 2012 at 12:45 PM, Julian Foad <ju...@btopenworld.com> wrote:
> Ashod Nakashian wrote:
>
>> Daniel Shahaf wrote:
>>> In short: if 'mount -o compress=yes' provides 90% space savings then
>> we
>>> would have little reason to implement space-saving solutions in svn itself.
>>> But it's the user's, not svn's, responsibility to run that.
>
> By the way, Daniel, I'm not ruling out the possibility that we may want to provide some glue logic so that Subversion can help the user to set up the feature. Without such assistance, only expert users would ever benefit.
But perhaps only expert users *need* the benefit.
Subversion has always been a system that is easy to deploy and admin,
particularly for the small-shop folks. Those guys are happy to with
reasonable defaults, and expect Subversion to just stay out the way so
they can get Real Work done.
The big shops, the ones with 100GB working copies, are the people who
are most interested in the disk space savings possible from compressed
pristines, because they are the people who stand to benefit the most.
Those folks have the resources to customize their Subversion
installations, and most likely will. They also likely have people
whose *entire job* is to optimize the system, and we should trust them
to do that job, not coddle them.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
----- Original Message -----
> From: Julian Foad <ju...@btopenworld.com>
> To: Ashod Nakashian <as...@yahoo.com>
> Cc: Daniel Shahaf <da...@elego.de>; Markus Schaber <m....@3s-software.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
> Sent: Wednesday, April 4, 2012 9:45 PM
> Subject: Re: Compressed Pristines (Summary)
>
> Ashod Nakashian wrote:
>
>> Daniel Shahaf wrote:
>>>>> Would you like to assess the feasibility of compressing the
> pristine
>>>> >store by re-mounting the "pristines" subdirectory as
> a compressed
>>>> >subtree in the operating system's file system?
>>>>
>>>> No :-)
>>>>
>>>> There are two ways to answer this interesting proposition of
>>>> compressed file-systems. The obvious one is that it isn't
> something
>>>> SVN can or should control. The file-system and certainly system
>>>> drivers are up to the user and any requirement or suggestion of
>>>> tempering with them is decidedly unwarranted and unexpected from
>>>> a VCS.
>>>
>>> The suggestion wasn't that you teach svn how to change the OS's
> fs
>>> settinsg, it was that you investigate how solutions at the OS level
>>> compare to the other approaches already suggested (custom format -based
>>> and sqlite-based pristine store).
>
> Yes, Daniel, that's exactly what I meant. Sorry, Ash, for not being clear
> enough.
>
> Of course that's inherently a non-portable solution that may not be
> available on all platforms and certainly will differ. But that's
> somewhat analogous to support for password storage: in Windows land
> there's a standard way to do it, in Unixy lands you have to choose your
> favourite third-party subsystem and externally configure Gnome-keyring or
> KDE-wallet or whatever you chose. Of course there are other
> disadvantages too, I just think it would be interesting to compare the
> disadvantages with the advantages.
>
>> That's an easy question. The answer is that at *best* they'll do as
> good
>> as in-place compression. However, in practice they'll do much worse.
>
> Ash, what's your measure of "best" here -- just the compression
> ratio? What about other kinds of goodness such as the automatic recovering of
> free space, and the ability to present a plain-text view of the file content
> through the standard filesystem API which eliminates the need for us to
> implement a plain-text cache in Subversion?
>
>> The
>> reason is that the OS level compression works on not only the single file
> level,
>> but actually at the block level. This is to make modifications reasonably
> fast
>> (read compressed data, uncompress, modify, write recompressed data). If the
>
>> complete file is compressed then even changing a single byte (neglecting
> that no
>> storage works on the byte-level anyway) will yield performance that will at
>
>> least linearly degrade by the filesize.
>
> Changing a single byte is an irrelevant scenario, because pristine files are
> always created in full and then never modified.
But the OS compression doesn't know that! It's design assumes average file modification operations, and that's rarely replacing the full file (which is the norm for us). I was only explaining and justifying the design decision of OS level compression.
>
>>> In short: if 'mount -o compress=yes' provides 90% space savings
> then
>> we
>>> would have little reason to implement space-saving solutions in svn
> itself.
>>> But it's the user's, not svn's, responsibility to run that.
>
> By the way, Daniel, I'm not ruling out the possibility that we may want to
> provide some glue logic so that Subversion can help the user to set up the
> feature. Without such assistance, only expert users would ever benefit.
>
> It's clearly an interesting topic!
>
> - Julian
>
Re: Compressed Pristines (Summary)
Posted by Julian Foad <ju...@btopenworld.com>.
Ashod Nakashian wrote:
> Daniel Shahaf wrote:
>>>> Would you like to assess the feasibility of compressing the pristine
>>> >store by re-mounting the "pristines" subdirectory as a compressed
>>> >subtree in the operating system's file system?
>>>
>>> No :-)
>>>
>>> There are two ways to answer this interesting proposition of
>>> compressed file-systems. The obvious one is that it isn't something
>>> SVN can or should control. The file-system and certainly system
>>> drivers are up to the user and any requirement or suggestion of
>>> tempering with them is decidedly unwarranted and unexpected from
>>> a VCS.
>>
>> The suggestion wasn't that you teach svn how to change the OS's fs
>> settinsg, it was that you investigate how solutions at the OS level
>> compare to the other approaches already suggested (custom format -based
>> and sqlite-based pristine store).
Yes, Daniel, that's exactly what I meant. Sorry, Ash, for not being clear enough.
Of course that's inherently a non-portable solution that may not be
available on all platforms and certainly will differ. But that's
somewhat analogous to support for password storage: in Windows land
there's a standard way to do it, in Unixy lands you have to choose your
favourite third-party subsystem and externally configure Gnome-keyring or KDE-wallet or whatever you chose. Of course there are other
disadvantages too, I just think it would be interesting to compare the
disadvantages with the advantages.
> That's an easy question. The answer is that at *best* they'll do as good
> as in-place compression. However, in practice they'll do much worse.
Ash, what's your measure of "best" here -- just the compression ratio? What about other kinds of goodness such as the automatic recovering of free space, and the ability to present a plain-text view of the file content through the standard filesystem API which eliminates the need for us to implement a plain-text cache in Subversion?
> The
> reason is that the OS level compression works on not only the single file level,
> but actually at the block level. This is to make modifications reasonably fast
> (read compressed data, uncompress, modify, write recompressed data). If the
> complete file is compressed then even changing a single byte (neglecting that no
> storage works on the byte-level anyway) will yield performance that will at
> least linearly degrade by the filesize.
Changing a single byte is an irrelevant scenario, because pristine files are always created in full and then never modified.
>> In short: if 'mount -o compress=yes' provides 90% space savings then
> we
>> would have little reason to implement space-saving solutions in svn itself.
>> But it's the user's, not svn's, responsibility to run that.
By the way, Daniel, I'm not ruling out the possibility that we may want to provide some glue logic so that Subversion can help the user to set up the feature. Without such assistance, only expert users would ever benefit.
It's clearly an interesting topic!
- Julian
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
>________________________________
> From: Mark Phippard <ma...@gmail.com>
>To: Ashod Nakashian <as...@yahoo.com>
>Cc: Daniel Shahaf <da...@elego.de>; Markus Schaber <m....@3s-software.com>; "julianfoad@btopenworld.com" <ju...@btopenworld.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
>Sent: Wednesday, April 4, 2012 9:23 PM
>Subject: Re: Compressed Pristines (Summary)
>
>On Wed, Apr 4, 2012 at 1:18 PM, Ashod Nakashian
><as...@yahoo.com> wrote:
>
>> That's an easy question. The answer is that at *best* they'll do as good as in-place compression. However, in practice
>> they'll do much worse. The reason is that the OS level compression works on not only the single file level, but actually
>> at the block level. This is to make modifications reasonably fast (read compressed data, uncompress, modify, write
>> recompressed data). If the complete file is compressed then even changing a single byte (neglecting that no storage
>> works on the byte-level anyway) will yield performance that will at least linearly degrade by the filesize.
>
>FWIW, that is exactly my concern with your custom file format. I do
>not see how you can achieve the benefits you expect without needing to
>repack files and I do not see how that can perform reasonably.
That's the tricky part of course. To attack this problem we need to strike a balance between pack size and how aggressively we repack to regain wasted "holes". It's not difficult to find a good middle-ground because working with a few MBs is reasonably fast (please see the estimations on size/speed in the proposal) and the waste of a full block is negligible for a file of even 1MB of size. I'm oversimplifying to convey a point: we don't need optimality, we need a practical approach that yields the biggest bang for our buck. And as far as that goes, I'm in agreement with the sentiment of settling for the easiest solution that gets us the farthest. It's just that we haven't yet reached consensus on what that is! :-)
>
>That said, you also seem aware that the solution has to perform well
>so at worst it is just a question as to whether you want to spend the
>cycles to prove it can work and achieve all the goals. I am skeptical
>but look forward to being wrong.
>
>The lazy part of me thinks storing files up to 32KB in SQLite and
>storing the rest as just single compressed files would give 99% of our
>users what they want and would be less likely to have issues.
I have to agree with you here. We just need to get working on having something that can actually work and verified to meet this goal. If we can do that *with decent performance* then we have a clear winner.
-Ash
>
>--
>Thanks
>
>Mark Phippard
>http://markphip.blogspot.com/
>
>
>
Re: Compressed Pristines (Summary)
Posted by Mark Phippard <ma...@gmail.com>.
On Wed, Apr 4, 2012 at 1:18 PM, Ashod Nakashian
<as...@yahoo.com> wrote:
> That's an easy question. The answer is that at *best* they'll do as good as in-place compression. However, in practice
> they'll do much worse. The reason is that the OS level compression works on not only the single file level, but actually
> at the block level. This is to make modifications reasonably fast (read compressed data, uncompress, modify, write
> recompressed data). If the complete file is compressed then even changing a single byte (neglecting that no storage
> works on the byte-level anyway) will yield performance that will at least linearly degrade by the filesize.
FWIW, that is exactly my concern with your custom file format. I do
not see how you can achieve the benefits you expect without needing to
repack files and I do not see how that can perform reasonably.
That said, you also seem aware that the solution has to perform well
so at worst it is just a question as to whether you want to spend the
cycles to prove it can work and achieve all the goals. I am skeptical
but look forward to being wrong.
The lazy part of me thinks storing files up to 32KB in SQLite and
storing the rest as just single compressed files would give 99% of our
users what they want and would be less likely to have issues.
--
Thanks
Mark Phippard
http://markphip.blogspot.com/
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
>________________________________
> From: Daniel Shahaf <da...@elego.de>
>To: Ashod Nakashian <as...@yahoo.com>
>Cc: Markus Schaber <m....@3s-software.com>; "julianfoad@btopenworld.com" <ju...@btopenworld.com>; "mtherieau@gmail.com" <mt...@gmail.com>; Subversion Development <de...@subversion.apache.org>
>Sent: Wednesday, April 4, 2012 9:46 AM
>Subject: Re: Compressed Pristines (Summary)
>
>> >1. Filesystem compression.
>> >
>> >Would you like to assess the feasibility of compressing the pristine
>> >store by re-mounting the "pristines" subdirectory as a compressed
>> >subtree in the operating system's file system?
>>
>> No :-)
>>
>> There are two ways to answer this interesting proposition of
>> compressed file-systems. The obvious one is that it isn't something
>> SVN can or should control. The file-system and certainly system
>> drivers are up to the user and any requirement or suggestion of
>> tempering with them is decidedly unwarranted and unexpected from
>> a VCS.
>
>The suggestion wasn't that you teach svn how to change the OS's fs
>settinsg, it was that you investigate how solutions at the OS level
>compare to the other approaches already suggested (custom format -based
>and sqlite-based pristine store).
That's an easy question. The answer is that at *best* they'll do as good as in-place compression. However, in practice they'll do much worse. The reason is that the OS level compression works on not only the single file level, but actually at the block level. This is to make modifications reasonably fast (read compressed data, uncompress, modify, write recompressed data). If the complete file is compressed then even changing a single byte (neglecting that no storage works on the byte-level anyway) will yield performance that will at least linearly degrade by the filesize.
>
>In short: if 'mount -o compress=yes' provides 90% space savings then we
>would have little reason to implement space-saving solutions in svn itself.
>But it's the user's, not svn's, responsibility to run that.
I should kindly disagree here. The user can do that any time, anyway. SVN is trying to improve its pristine store design, not advise users on how best to organize their storage (in general or when using SVN). In addition, I find discriminating against users who don't have that luxury or knowledge to be a bit unfair. At least if are claiming to support the wide range of systems that we do.
-Ash
>
Re: Compressed Pristines (Summary)
Posted by Daniel Shahaf <da...@elego.de>.
> >1. Filesystem compression.
> >
> >Would you like to assess the feasibility of compressing the pristine
> >store by re-mounting the "pristines" subdirectory as a compressed
> >subtree in the operating system's file system?
>
> No :-)
>
> There are two ways to answer this interesting proposition of
> compressed file-systems. The obvious one is that it isn't something
> SVN can or should control. The file-system and certainly system
> drivers are up to the user and any requirement or suggestion of
> tempering with them is decidedly unwarranted and unexpected from
> a VCS.
The suggestion wasn't that you teach svn how to change the OS's fs
settinsg, it was that you investigate how solutions at the OS level
compare to the other approaches already suggested (custom format -based
and sqlite-based pristine store).
In short: if 'mount -o compress=yes' provides 90% space savings then we
would have little reason to implement space-saving solutions in svn itself.
But it's the user's, not svn's, responsibility to run that.
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
----- Original Message -----
> From: Branko Čibej <br...@apache.org>
> To: Ashod Nakashian <as...@yahoo.com>
> Cc: "dev@subversion.apache.org" <de...@subversion.apache.org>
> Sent: Sunday, April 1, 2012 12:23 PM
> Subject: Re: Compressed Pristines (Summary)
>
> On 31.03.2012 23:30, Ashod Nakashian wrote:
>>>> Git can keep deleted items until git-gc is invoked, should we
> support
>>> something similar, we need to be consistent and probably support
> arbitrary
>>> revision history, which is out of scope.
>>>
>>> I'm confused: how does revision history affect the pristine store?
>> If the pristine store also keeps multiple revisions, then it's a whole
> different set of features than what we are aiming for (at least for compressed
> pristines).
>
> Certainly the pristine store keeps multiple revisions of files. After
> all, it's just a SHA-1 => contents dictionary, so every time you
> "svn
> update," you'll get new revisions of files in the pristine store.
Sure. I meant multiple revisions of the same file. You're absolutely right, the PS tracks SHA-1 and whether two files are revisions of the /same/ file or not isn't relevant. What I meant to say is that if we are to have such a case, we probably need to add support for it on the higher level where files/revisions/SHA-1's/references are tracked. This is out of scope and changes the very definition of the PS as we have it now.
>
> What the store doesn't do is /know/ about the revisions. Neither does
> the wc.db, which only tracks reference counts for the SHA-1 keys. Every
> time a file changes, its hash will change, too, a new key will be
> inserted in the pristine store, and the reference count for the old key
> will be decremented. I'm not sure what happens when the count reaches
> zero; used to be that only "svn cleanup" would delete unreferenced
> pristines, but ISTR this changed a while ago.
>
> In any case, the pristine store shouldn't worry about revisions, only
> about efficiently storing the contents. It doesn't even have to worry
> about reference counting, since wc.db already does that.
>
> -- Brane
>
>
> P.S.: If we ever implement local snapshots and/or local branches, it
> /still/ won't be the pristine store's problem to track whole-tree info.
> This is why I like the clear separation between pristine store, which is
> a simple dictionary, and wc.db, which is moderately complex.
>
>
> P.P.S.: When we transition from pristine store per working copy to
> pristine store per ~/.subversion directory, then the pristine store will
> have to track how many working copies are using it. But that's way in
> the future -- and another good reason to use a proper database for the
> indexing.
>
Sure. We're on the same page here on all points.
-Ash
Re: Compressed Pristines (Summary)
Posted by Branko Čibej <br...@apache.org>.
On 31.03.2012 23:30, Ashod Nakashian wrote:
>>> Git can keep deleted items until git-gc is invoked, should we support
>> something similar, we need to be consistent and probably support arbitrary
>> revision history, which is out of scope.
>>
>> I'm confused: how does revision history affect the pristine store?
> If the pristine store also keeps multiple revisions, then it's a whole different set of features than what we are aiming for (at least for compressed pristines).
Certainly the pristine store keeps multiple revisions of files. After
all, it's just a SHA-1 => contents dictionary, so every time you "svn
update," you'll get new revisions of files in the pristine store.
What the store doesn't do is /know/ about the revisions. Neither does
the wc.db, which only tracks reference counts for the SHA-1 keys. Every
time a file changes, its hash will change, too, a new key will be
inserted in the pristine store, and the reference count for the old key
will be decremented. I'm not sure what happens when the count reaches
zero; used to be that only "svn cleanup" would delete unreferenced
pristines, but ISTR this changed a while ago.
In any case, the pristine store shouldn't worry about revisions, only
about efficiently storing the contents. It doesn't even have to worry
about reference counting, since wc.db already does that.
-- Brane
P.S.: If we ever implement local snapshots and/or local branches, it
/still/ won't be the pristine store's problem to track whole-tree info.
This is why I like the clear separation between pristine store, which is
a simple dictionary, and wc.db, which is moderately complex.
P.P.S.: When we transition from pristine store per working copy to
pristine store per ~/.subversion directory, then the pristine store will
have to track how many working copies are using it. But that's way in
the future -- and another good reason to use a proper database for the
indexing.
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
----- Original Message -----
> From: Branko Čibej <br...@apache.org>
> To: dev@subversion.apache.org
> Cc:
> Sent: Sunday, April 1, 2012 12:58 AM
> Subject: Re: Compressed Pristines (Summary)
>
> On 31.03.2012 18:16, Ashod Nakashian wrote:
>> So it's fair to say I'm ignorant about the details, but I must say
> this: A repository, precisely like Git pack files, don't necessarily need
> good (if at all) support of deletion. This is a very critical issue that I can
> see why it might not be obvious at first.
>
> Instead of repeating the obvious, I suggest you start reading here:
>
> http://www.sqlite.org/pragma.html#pragma_auto_vacuum
>
> It's clear that, in order to optimize the pristine store, the pristine
> files should not be stored in wc.db but in a separate database (simply
> because auto-vacuum optimization will be different for wc.db and
> pristine.db). Apart from that, I still don't see how a custom pack
> format can do better in the short term than what SQLite already does.
>
In the short term, it probably won't do any better (especially for small WC's). In the long term, we'll have control over both organization/defragmentation, compression, and virtually all operations and behaviors. As for the PS residing in a separate db, I think there is no question about that - it should be separate from wc.db.
>
>> Git can keep deleted items until git-gc is invoked, should we support
> something similar, we need to be consistent and probably support arbitrary
> revision history, which is out of scope.
>
> I'm confused: how does revision history affect the pristine store?
If the pristine store also keeps multiple revisions, then it's a whole different set of features than what we are aiming for (at least for compressed pristines).
>
>> Sqlite (which internally uses a b-tree pointing to fixed-size pages that
> overflow using linked-lists) is designed for fast
> additions/modifications/deletions of typically tiny data (a row is reasonably
> assumed to be -much- less than a page in most cases)
>
> Are you quite sure about that? Certainly, the /keys/ need to be much
> smaller than a page size in order for the B+-tree implementation to be
> reasonably efficient, but I can't see how that can be the case for
> BLOBs, which are treated differently all the way from SQL semantics
> level to the C API, and aren't keys.
Yes, I'm fairly certain. There are b-tree specific pages that hold the b-tree information. See http://www.sqlite.org/fileformat2.html for more details. But again, I'd like to have hard numbers than to speculate based on theory.
>
>> and *without* promising a compact footprint, which we dearly care about.
>
> Not all the time. It's OK to make it "compact" only during
> "svn
> cleanup", and if we add a "--gc" option to that (which would, I
> expect,
> invoke SQLite's VACUUM command), then the user will clearly understand
> that they're trading time for space.
Fair enough, provided that's a reasonable compromise that is documented and given.
>
>> We will be doing the same on KBytes worth of data for each entry. This is
> something that we must certainly research more with actual data. However in my
> mind our
>> use-case is quite different from what Sqlite is designed to do best, which
> is why I'm suggesting we do some benchmarking if we go with Sqlite.
>>
>> Just wanted to make this clear just to be sure we're not talking cross
> purposes at this point.
>
> I suspect that benchmarking for its own sake is not worth the trouble at
> this point. Just go and start implementing the proposal, it'll be a lot
> easer to benchmark once the client actually uses the compressed, packed
> pristine store -- because you'll be able to use real-world datasets, not
> contrived ones.
Yes, I meant benchmarking actual implementation to collect more data to decide how to proceed.
>
> Since we now have a set of performance tests, it might not be a bad idea
> to incorporate compressed/uncompressed pristine in the comparison charts.
Absolutely, agreed.
-Ash
>
> -- Brane
>
Re: Compressed Pristines (Summary)
Posted by Branko Čibej <br...@apache.org>.
On 31.03.2012 18:16, Ashod Nakashian wrote:
> So it's fair to say I'm ignorant about the details, but I must say this: A repository, precisely like Git pack files, don't necessarily need good (if at all) support of deletion. This is a very critical issue that I can see why it might not be obvious at first.
Instead of repeating the obvious, I suggest you start reading here:
http://www.sqlite.org/pragma.html#pragma_auto_vacuum
It's clear that, in order to optimize the pristine store, the pristine
files should not be stored in wc.db but in a separate database (simply
because auto-vacuum optimization will be different for wc.db and
pristine.db). Apart from that, I still don't see how a custom pack
format can do better in the short term than what SQLite already does.
> Git can keep deleted items until git-gc is invoked, should we support something similar, we need to be consistent and probably support arbitrary revision history, which is out of scope.
I'm confused: how does revision history affect the pristine store?
> Sqlite (which internally uses a b-tree pointing to fixed-size pages that overflow using linked-lists) is designed for fast additions/modifications/deletions of typically tiny data (a row is reasonably assumed to be -much- less than a page in most cases)
Are you quite sure about that? Certainly, the /keys/ need to be much
smaller than a page size in order for the B+-tree implementation to be
reasonably efficient, but I can't see how that can be the case for
BLOBs, which are treated differently all the way from SQL semantics
level to the C API, and aren't keys.
> and *without* promising a compact footprint, which we dearly care about.
Not all the time. It's OK to make it "compact" only during "svn
cleanup", and if we add a "--gc" option to that (which would, I expect,
invoke SQLite's VACUUM command), then the user will clearly understand
that they're trading time for space.
> We will be doing the same on KBytes worth of data for each entry. This is something that we must certainly research more with actual data. However in my mind our
> use-case is quite different from what Sqlite is designed to do best, which is why I'm suggesting we do some benchmarking if we go with Sqlite.
>
> Just wanted to make this clear just to be sure we're not talking cross purposes at this point.
I suspect that benchmarking for its own sake is not worth the trouble at
this point. Just go and start implementing the proposal, it'll be a lot
easer to benchmark once the client actually uses the compressed, packed
pristine store -- because you'll be able to use real-world datasets, not
contrived ones.
Since we now have a set of performance tests, it might not be a bad idea
to incorporate compressed/uncompressed pristine in the comparison charts.
-- Brane
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
----- Original Message -----
> From: Stefan Sperling <st...@elego.de>
> To: Ashod Nakashian <as...@yahoo.com>
> Cc: "dev@subversion.apache.org" <de...@subversion.apache.org>
> Sent: Saturday, March 31, 2012 7:47 PM
> Subject: Re: Compressed Pristines (Summary)
>
> On Sat, Mar 31, 2012 at 01:31:15AM -0700, Ashod Nakashian wrote:
>> ::Summary::
>
> Thanks for summarizing the discussion.
> This summary was very useful to me.
>
>> 3) Sqlite has a very reputable code-base and performance, in addition
>> to already being utilized by SVN. A proposal to use it for small
>> pristine file storage has been proposed. The major advantage is the
>> possibility of abusing and/or overloading Sqlite with this kind of
>> usage that it probably isn't optimized to handle.
>
> Sqlite should be capable of handling this well.
> Are you aware of fossil (http://fossil-scm.org)?
> This is the version control system used to manage sqlite, and not
> surprisingly it stores all of its revision and working copy meta
> data in sqlite. Fossil is kept very simple at its core and might
> have scalability issues with very large projects (such as webkit)
> but nevertheless it is very inspiring. It might be worthwhile to
> take a look at the details of how fossil stores revision file data
> (because fossil is a distributed version control system the pristine
> files are simply stored in the last committed revision).
I hadn't known that fossil uses sqlite, although I was familiar with it (if nothing, because Sqlite uses it!).
So it's fair to say I'm ignorant about the details, but I must say this: A repository, precisely like Git pack files, don't necessarily need good (if at all) support of deletion. This is a very critical issue that I can see why it might not be obvious at first. At least one person (sorry, I don't readily have a name) raised a possible reinventing-the-wheel flag with the proposed pack format and Git's pack file. Git's pack *is* the repository. Technically, a repository needs to at least emulate the behavior of deletes, but it certainly doesn't have the performance issue as they almost never support arbitrary deletions (that is, history rewriting by removing a historical versions of files). Git has some support of history rewriting (typically via rebase) but even then, it can defer housekeeping cleanup to git-gc, which is a slow and by definition an offline operation. Compare this with our case where we keep the latest revision (known to us) only and all
files are subject to updates/modification and deletion upon invoking SVN commands. Whatever our pristine storage, it must do these rather swiftly. (I know I'm oversimplifying, but I trust I'm not misrepresenting.)
If we find some way to go around this requirement (say by doing things "quick'n'dirty" and deferring cleanups) then we probably can reuse some of the numerous archives, be it Git's pack or any other. But that comes at a cost and, unlike Git, we don't have any advantages to offer in return. Git can keep deleted items until git-gc is invoked, should we support something similar, we need to be consistent and probably support arbitrary revision history, which is out of scope. Sqlite (which internally uses a b-tree pointing to fixed-size pages that overflow using linked-lists) is designed for fast additions/modifications/deletions of typically tiny data (a row is reasonably assumed to be -much- less than a page in most cases) and *without* promising a compact footprint, which we dearly care about. We will be doing the same on KBytes worth of data for each entry. This is something that we must certainly research more with actual data. However in my mind our
use-case is quite different from what Sqlite is designed to do best, which is why I'm suggesting we do some benchmarking if we go with Sqlite.
Just wanted to make this clear just to be sure we're not talking cross purposes at this point.
>
> I haven't yet spent enough time thinking about compressed pristines
> to have an opinion about which approach we should take. But I'm very
> much looking forward to seeing a patch that implements a first step
> or first milestone of whichever approach we're going to settle on.
>
> I'm glad to see somebody driving this feature forward. Thanks!
>
Thanks Stephan! I'm excited about the prospects myself.
-Ash
Re: Compressed Pristines (Summary)
Posted by Stefan Sperling <st...@elego.de>.
On Sat, Mar 31, 2012 at 01:31:15AM -0700, Ashod Nakashian wrote:
> ::Summary::
Thanks for summarizing the discussion.
This summary was very useful to me.
> 3) Sqlite has a very reputable code-base and performance, in addition
> to already being utilized by SVN. A proposal to use it for small
> pristine file storage has been proposed. The major advantage is the
> possibility of abusing and/or overloading Sqlite with this kind of
> usage that it probably isn't optimized to handle.
Sqlite should be capable of handling this well.
Are you aware of fossil (http://fossil-scm.org)?
This is the version control system used to manage sqlite, and not
surprisingly it stores all of its revision and working copy meta
data in sqlite. Fossil is kept very simple at its core and might
have scalability issues with very large projects (such as webkit)
but nevertheless it is very inspiring. It might be worthwhile to
take a look at the details of how fossil stores revision file data
(because fossil is a distributed version control system the pristine
files are simply stored in the last committed revision).
I haven't yet spent enough time thinking about compressed pristines
to have an opinion about which approach we should take. But I'm very
much looking forward to seeing a patch that implements a first step
or first milestone of whichever approach we're going to settle on.
I'm glad to see somebody driving this feature forward. Thanks!
Re: Compressed Pristines (Call for Vote)
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Julian Foad wrote on Mon, Mar 26, 2012 at 13:00:58 +0100:
> Ashod Nakashian wrote:
> [...]
>
> > *Let's vote on a design and a plan to get us there.* At this point I can
> > only wait for everyone to catch up, do their tests and run their numbers and
> > vote on what they think will best benefit the community in the long run.
> >
We don't vote on design plans around here, we achieve consensus.
> > ::Subversion Compressed Pristines Simulation::
> > Disk block-size is 4096 bytes.
> >
> > Checking out http://svn.apache.org/repos/asf/subversion/trunk/
> > svn: .svn-base is 44730415 bytes in 1882 files, 23767 average file size.
> > Sub-block waste 3942353 (8.81%)
> > svn: .svn-base.GZ is 16044735 bytes in 1882 files, 8525 average gz file size.
> > Sub-block waste 4644161 (28.94%)
> [... pages and pages of numbers :-) ...]
>
> Please summarize all the data you have in just a few lines with only
> 2 significant figures of precision, if you want casual readers such as
> me to be able to make any sense of it!
>
Summarizing the thread might be a good idea, I haven't had time to read
it all and I suspect I'm not alone in that.
> - Julian
Re: Compressed Pristines (Call for Vote)
Posted by Julian Foad <ju...@btopenworld.com>.
Ashod Nakashian wrote:
[...]
> *Let's vote on a design and a plan to get us there.* At this point I can
> only wait for everyone to catch up, do their tests and run their numbers and
> vote on what they think will best benefit the community in the long run.
>
> ::Subversion Compressed Pristines Simulation::
> Disk block-size is 4096 bytes.
>
> Checking out http://svn.apache.org/repos/asf/subversion/trunk/
> svn: .svn-base is 44730415 bytes in 1882 files, 23767 average file size.
> Sub-block waste 3942353 (8.81%)
> svn: .svn-base.GZ is 16044735 bytes in 1882 files, 8525 average gz file size.
> Sub-block waste 4644161 (28.94%)
[... pages and pages of numbers :-) ...]
Please summarize all the data you have in just a few lines with only 2 significant figures of precision, if you want casual readers such as me to be able to make any sense of it!
- Julian
Re: Compressed Pristines (Summary)
Posted by Julian Foad <ju...@btopenworld.com>.
Hi Ashnod.
1. Filesystem compression.
Would you like to assess the
feasibility of compressing the pristine store by re-mounting the
"pristines" subdirectory as a compressed subtree in the operating
system's file system? This can be done (I believe) under Windows with
NTFS <http://support.microsoft.com/kb/307987> and under Linux with FUSE-compress
<http://code.google.com/p/fusecompress/>. Certainly the
trade-offs are different, compared with implementing compression inside Subversion, but delegating the task to a third-party
subsytem could give us a huge advantage in terms of reducing the ongoing maintenance cost.
2. Uncompressed copies.
There has been a lot of discussion about achieving maximal compression by exploiting properties of similarity, ordering, and so on. That is an interesting topic. However, compression is notthe only thing the pristine store needs to do.
The pristine store implementation also needs to provide *uncompressed* copies of the files. Some of the API consumers can and should read the data through svn_stream_t; this is the easy part. Other API consumers -- primarily those that invoke an external 'diff' tool -- need to be given access to a complete uncompressed file on disk.
At the moment, we just pass them the path to the file in the pristine store. When the pristine file is compressed, I imagine we will need to implement a cache of uncompressed copies of the pristine files. The lifetimes of those uncompressed copies will need to be managed, and this may require some changes to the interface that is used to access them. A typical problem is: user runs "svn diff", svn starts up a GUI diff tool and passes it two paths: the path to an uncompressed copy of a pristine file, and the path of a working-copy file. The GUI tool runs as a separate process and the "svn" process finishes. Now the GUI diff is still running, accessing a file in our uncompressed-pristines cache. How do we manage this so that we don't immediately delete the uncompressed file while the GUI diff is still displaying it, and yet also know when to clean up our cache later?
We could of course declare that the "pristine store" software layer is only responsible for providing streamy read access, and the management of uncompressed copies is the responsibility of higher level code. But no matter where we draw the boundary, that functionality has to be designed and implemented before we can successfully use any kind of compression.
- Julian
>________________________________
> From: Ashod Nakashian <as...@yahoo.com>
>
>In an attempt to reduce the footprint of pristine files in a working copy (WC) the compressed pristines (CP) feature is proposed[1]. There has been discussion and debates regarding the particulars of the proposal. This is a summary of this discussion and consolidation/checkpoint of the thread in preparation to move forward. I tried to keep it short, but there is quite a bit of technical details that are pertinent and should be included for a balanced picture.
>
>::Summary::
>
>The design document[1] outlines rationale behind the feature as well as requirements. So far these weren't challenged. To summarize them:
>
>Pristine files currently incur almost 100%[2] overhead both in terms of disk footprint and file count in a given WC. Since pristine files is a design element of SVN, reducing their inherent overhead should be a welcome improvement to SVN from a user's perspective. Due to the nature of source files that tend to be small, the footprint of a pristine store (PS) is larger on disk than the actual total bytes because of internal fragmentation (file-system block-size rounding waste) - see references for numbers. The proposal takes this into consideration and proposes packing small files together into larger files to reduce this sub-block waste to a minimum. The packing of pristine files introduced a new complication, however, that of efficiently adding and removing pristine files from a pack. The solution was to introduce a minimalist custom file format to support SVN requirements from the ground up. This custom file format has been challenged by many members
>of the community.
>
>::Solutions::
>
>Broadly speaking, there has been 3 proposed designs for the CP feature.
>
>1) In-place compressed files (aka gzipped pristine files).
>2) Custom pack files (split by a cutoff size so large files are practically compressed in-place).
>3) Sqlite database (for small files + files on disk for large ones).
>
>::Observations::
>
>There has been tests and simulations[3][4][5] that attempted to collect hard numbers on the 3 alternatives. The gist of all that can be summarized as follows:
>
>a) Sub-block waste of 10-50% was observed on untouched SVN1.7 checkouts[6].
>b) Sub-block waste increases for in-place compression percentage-wise, limiting the potential savings[7].
>c) In-place compressed files when combined (packed) a *further* 150-500% reduction was obtained [8].
>d) Projects that have a very large number of files (50k+) tend to have a small average size, hence they have the biggest potential to gain from reduced sub-block waste and faster file-reads thanks to packing (reduced disk seeks and improved read cache utilization).
>e) Sqlite has a solid offering that may be used to pack small files easily.
>f) Sqlite may suffer from external fragmentation (holes in the file that aren't used due to deletions) which counterweights the savings by keeping the PS footprint artificially larger than necessary.
>g) Sqlite is *not* suitable for large files (typically anything beyond several dozens of KBs).
>
>::Critique::
>
>1) In-place compression has the flattest technical challenges curve. It's readily available via the compressed streams API in SVN using Zlib. While this is a huge advantage, the reduction in disk space is limited. Tests show that in the best case scenario (one case only) 60% compression wasn't attainable and most cases didn't hit 50% while others were limited to 25%. Packed compression improved these numbers by 150% for the first case and exceeded 500% in the other extreme. In addition, in-place compression will not reduce pressure on the file-system and can't exploit any advantages that the other two proposals do. A minor disadvantage voices is the fact that the pristine files remain transparent to the users and may potentially encourage unsupported manipulations.
>
>2) A custom file format holds the promise of supporting an arbitrary number of requirements, is self-contained, extensibility and flexibility. The implementation may be incrementally improved to add new features and operations that yield improved performance and/or disk savings. Once we have a custom format, we can sort and combine files before compression to exploit inter-file similarities. This is shown to yield significant savings without adding too much complexity (see references for numbers). The major critique of this approach is that of the overhead, risks and complexity associated with implementing and maintaining a custom file format of release grade. If the benefits are doubtful to justify this overhead, then we should forgo going this route.
>
>3) Sqlite has a very reputable code-base and performance, in addition to already being utilized by SVN. A proposal to use it for small pristine file storage has been proposed. The major advantage is the possibility of abusing and/or overloading Sqlite with this kind of usage that it probably isn't optimized to handle. In addition, if the database file increases too much, performance and disk usage may deteriorate and require costly maintenance passes to improve them. Sqlite will not handle large file, which will be stored separately on disk, this is similar to the custom file format case where large files will end up not sharing other files in the pack file they are in.
>
>::Conclusion::
>
>Regardless of what approach we take, it'll most probably feature two properties: incremental implementation and benchmarking. The simplest approach could be taken first, keeping in mind that we need to collect more data and perform rigorous testing to ensure stability and reliability. In-place compression while very easily attainable in implementation, is very limited and will serve only the smaller WC's with large average file-size. Sqlite holds a great promise that should be explored. Where the cutoff for small files are, what page-size should we choose and other Sqlite configuration details that may affect performance is subject to further research. Creating a custom file format that is simple, yet powerful enough to give us flexibility is still a very exciting possibility. One that should probably be explored if for nothing other than research and comparison. Sqlite can be used as a first implementation and the simplest working pack-file
>implementation may be added for comparison and experimentation.
>
>Thank you for reading. Please share your opinion, notes and concerns.
>
>[1] https://docs.google.com/document/d/1ktIsewfMBMVBxbn-Ng8NwkNwAS_QJ6eC7GOygsbBeEc/edit
>[2] Since pristines are stored using SHA-1 hash, identical files are stored only once.
>[3] http://mail-archives.apache.org/mod_mbox/subversion-dev/201203.mbox/%3C1332695820.9245.YahooMailNeo@web161401.mail.bf1.yahoo.com%3E
>[4] http://svn.haxx.se/dev/archive-2012-03/0573.shtml
>
>[5] http://svn.haxx.se/dev/archive-2012-03/0578.shtml
>
>[6] Tested trunks were SVN, GCC, WebKit, OOO and WP late March 2012.
>[7] Files on which compression doesn't reduce them by multiples of block size don't shrink on disk. Therefore, files smaller than a single block can never be shrunk more, even with the best compression algorithms.
>[8] These savings are due to inter-file similarities, sorting (exploits statistical similarities between same-type files) and avoiding sub-block waste. The latter has the biggest effect on WC's with small average file-sizes while sorting has the least effect in the order of single-digit percentage improvement.
>
>-Ash
>
>
>
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
Combined response inline...
> From: Markus Schaber <m....@3s-software.com>
>
>First, thanks for your great summary. I'll throw in just my 2 cents below.
The pleasure is mine.
> From: Markus Schaber <m....@3s-software.com>
>
>Was any of those tests actually executed on a file system supporting something like "block suballocation", "tail merging" or "tail packing"?
No, not to my knowledge. Mine was on standard installations of Ubuntu 11.10. And I was trying to calculate the waste on a system that *didn't* have them enabled.
> From: Markus Schaber <m....@3s-software.com>
>
>Today, I was rather surprised that my pristine subdir of one of our main projects which contains 726 MB of data has an actual disk size of 759 MB, which leads to an overhead of less than 4% due to block-size rounding. (According to the Explorer "Properties" dialog of Win 7 on a NTFS file system.)
Did you have NTFS compression enabled?
> From: Markus Schaber <m....@3s-software.com>
>
>AFAICS, "modern" file systems increasingly support that kind of feature[1], so we should at least think about how much effort we want to throw at the "packing" part of the problem if it's likely to vanish (or, at least, being drastically reduced) in the future.
[snip]
> From: Mark Therieau <mt...@gmail.com>
>
>Another thought would be to pursue a FUSE-like approach similar to scord [1][2]
[snip]
> From: Julian Foad <ju...@btopenworld.com>
>
>1. Filesystem compression.
>
>Would you like to assess the feasibility of compressing the pristine store by re-mounting the "pristines" subdirectory as a compressed subtree in the operating system's file system?
No :-)
There are two ways to answer this interesting proposition of compressed file-systems. The obvious one is that it isn't something SVN can or should control. The file-system and certainly system drivers are up to the user and any requirement or suggestion of tempering with them is decidedly unwarranted and unexpected from a VCS.
The second is more relevant, however. The user may *still* enable/use these schemes with or without compressed pristine support. After all, we are only concerned with the pristine store and *not* the working copy. So there is still room for these technologies, if/when the user feels so inclined to utilize them.
So I'd say there is nothing preventing the user from using them, at their responsibility, and get further gains in disk savings while at the same time they are markedly out of scope for compressed pristines feature, if not SVN as a system.
> From: Markus Schaber <m....@3s-software.com>
>
>Additionally, the simple and efficient way of storing the pristines in a SQLite database (one blob per file) also prevents us from exploiting inter-file redundancies during compression, while adding a packing layer on top of sqlite leads to both high complexity and a large average blob size, and large blobs are probably more efficiently handled by the FS directly.
Yes. That's what the proposal I drafted is claiming.
> From: Markus Schaber <m....@3s-software.com>
>
>To cut it short: I'll "take" whatever solution emerges, but my gut feeling tells me that we should use plain files as containers, instead of using sqlite.
>
>The other aspects (grouping similar files into the same container before compression, applying a size limit for containers, and storing uncompressible files in uncompressed containers) are fine as discussed.
>
>I'll try to run some statistics using publicly available projects on an NTFS file system, just for comparision.
>
That would be great. Please share your finds.
> From: Mark Therieau <mt...@gmail.com>
>
>If the full goal is to reduce pressure on the underlying file system in the presence
>of many large working copies (e.g. one per branch) then duplicate pristine contents,
>even with super-awesome compression would not match the space savings of a
>de-duplicated, pristine-aware, copy-on-write file system.
That's assuming there are many duplicates. This is certainly possible, especially with many branches/tags checked out from the same source. But I suspect it's a more common scenario to have a single branch checked out from different repositories. In other words, unless we have solid numbers that there is more savings by de-duplication, the working assumption is that improving a single branch by compression will be more useful to more users. Plus, your suggestion is probably part of the unified pristine store (aka ~/.svn) which is out of scope for compressed pristines.
> From: Julian Foad <ju...@btopenworld.com>
>
>The pristine store implementation also needs to provide
*uncompressed* copies of the files. Some of the API consumers can and
should read the data through svn_stream_t; this is the easy part. Other API consumers -- primarily those that invoke an external 'diff' tool -- need to be given access to a complete uncompressed file on disk.
This is certainly a -minor- complication we'll have to deal with. It's just a technicality, not a show stopper or a problem per-se. The pristine/tmp folder could be cleaned up via svn cleanup, for example, or at different check-points. The worse case scenarios are to either to clutter the disk by too many temp uncompressed pristines or to delete them prematurely and force the user to re-run their last command. These aren't fatal and it's easy to find a middle-ground to handle them.
-Ash
AW: Compressed Pristines (Summary)
Posted by Markus Schaber <m....@3s-software.com>.
Hi, Ashod,
First, thanks for your great summary. I'll throw in just my 2 cents below.
> Von: Ashod Nakashian [mailto:ashodnakashian@yahoo.com]
> Pristine files currently incur almost 100%[2] overhead both in terms of
> disk footprint and file count in a given WC. Since pristine files is a
> design element of SVN, reducing their inherent overhead should be a
> welcome improvement to SVN from a user's perspective. Due to the nature of
> source files that tend to be small, the footprint of a pristine store (PS)
> is larger on disk than the actual total bytes because of internal
> fragmentation (file-system block-size rounding waste) - see references for
> numbers.
Was any of those tests actually executed on a file system supporting something like "block suballocation", "tail merging" or "tail packing"?
Today, I was rather surprised that my pristine subdir of one of our main projects which contains 726 MB of data has an actual disk size of 759 MB, which leads to an overhead of less than 4% due to block-size rounding. (According to the Explorer "Properties" dialog of Win 7 on a NTFS file system.)
AFAICS, "modern" file systems increasingly support that kind of feature[1], so we should at least think about how much effort we want to throw at the "packing" part of the problem if it's likely to vanish (or, at least, being drastically reduced) in the future. My concern is that storing small pristines in their own SQLite database will also bring some overhead that may be in the same magnitude of 4%, due to SQLite Metadata, the necessary primary key column, and indexing.
Additionally, the simple and efficient way of storing the pristines in a SQLite database (one blob per file) also prevents us from exploiting inter-file redundancies during compression, while adding a packing layer on top of sqlite leads to both high complexity and a large average blob size, and large blobs are probably more efficiently handled by the FS directly.
To cut it short: I'll "take" whatever solution emerges, but my gut feeling tells me that we should use plain files as containers, instead of using sqlite.
The other aspects (grouping similar files into the same container before compression, applying a size limit for containers, and storing uncompressible files in uncompressed containers) are fine as discussed.
I'll try to run some statistics using publicly available projects on an NTFS file system, just for comparision.
Best regards
Markus Schaber
[1]: http://msdn.microsoft.com/en-us/library/windows/desktop/ee681827%28v=vs.85%29.aspx claims tail packing support for NTFS. http://en.wikipedia.org/wiki/Block_suballocation claims support for BtrFS, ReiserFS, Reiser4, FreeBSD UFS2. And AFAIR, XFS has a similar feature. Sadly, Ext[2,3,4] are not on that list yet, but rumors claim that Ext4 is to be replaced by BtrFS in the long run.
--
___________________________
We software Automation.
3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50
Email: m.schaber@3s-software.com | Web: http://www.3s-software.com
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
AW: Compressed Pristines (Summary)
Posted by Markus Schaber <m....@3s-software.com>.
Hi,
Von: Markus Schaber
> [ Speculation was: File-Systems providing tail packing / block ]
> [ suballocation like features may remove the need of the "packing" ]
> [ part of small pristines. ]
> I'll try to run some statistics using publicly available projects on an
> NTFS file system, just for comparision.
I did not yet have time to run that yet, but I found out that NTFS is documented to pack small files only up to around 600 bytes.
And given that the Ext2/3/4 family of file systems does not (and possibly never will) support tail packing, I guess that my argument was junk.
Best regards
Markus Schaber
--
___________________________
We software Automation.
3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50
Email: m.schaber@3s-software.com | Web: http://www.3s-software.com
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
Re: Compressed Pristines (Summary)
Posted by Ashod Nakashian <as...@yahoo.com>.
Hi,
In an attempt to reduce the footprint of pristine files in a working copy (WC) the compressed pristines (CP) feature is proposed[1]. There has been discussion and debates regarding the particulars of the proposal. This is a summary of this discussion and consolidation/checkpoint of the thread in preparation to move forward. I tried to keep it short, but there is quite a bit of technical details that are pertinent and should be included for a balanced picture.
::Summary::
The design document[1] outlines rationale behind the feature as well as requirements. So far these weren't challenged. To summarize them:
Pristine files currently incur almost 100%[2] overhead both in terms of disk footprint and file count in a given WC. Since pristine files is a design element of SVN, reducing their inherent overhead should be a welcome improvement to SVN from a user's perspective. Due to the nature of source files that tend to be small, the footprint of a pristine store (PS) is larger on disk than the actual total bytes because of internal fragmentation (file-system block-size rounding waste) - see references for numbers. The proposal takes this into consideration and proposes packing small files together into larger files to reduce this sub-block waste to a minimum. The packing of pristine files introduced a new complication, however, that of efficiently adding and removing pristine files from a pack. The solution was to introduce a minimalist custom file format to support SVN requirements from the ground up. This custom file format has been challenged by many members
of the community.
::Solutions::
Broadly speaking, there has been 3 proposed designs for the CP feature.
1) In-place compressed files (aka gzipped pristine files).
2) Custom pack files (split by a cutoff size so large files are practically compressed in-place).
3) Sqlite database (for small files + files on disk for large ones).
::Observations::
There has been tests and simulations[3][4][5] that attempted to collect hard numbers on the 3 alternatives. The gist of all that can be summarized as follows:
a) Sub-block waste of 10-50% was observed on untouched SVN1.7 checkouts[6].
b) Sub-block waste increases for in-place compression percentage-wise, limiting the potential savings[7].
c) In-place compressed files when combined (packed) a *further* 150-500% reduction was obtained [8].
d) Projects that have a very large number of files (50k+) tend to have a small average size, hence they have the biggest potential to gain from reduced sub-block waste and faster file-reads thanks to packing (reduced disk seeks and improved read cache utilization).
e) Sqlite has a solid offering that may be used to pack small files easily.
f) Sqlite may suffer from external fragmentation (holes in the file that aren't used due to deletions) which counterweights the savings by keeping the PS footprint artificially larger than necessary.
g) Sqlite is *not* suitable for large files (typically anything beyond several dozens of KBs).
::Critique::
1) In-place compression has the flattest technical challenges curve. It's readily available via the compressed streams API in SVN using Zlib. While this is a huge advantage, the reduction in disk space is limited. Tests show that in the best case scenario (one case only) 60% compression wasn't attainable and most cases didn't hit 50% while others were limited to 25%. Packed compression improved these numbers by 150% for the first case and exceeded 500% in the other extreme. In addition, in-place compression will not reduce pressure on the file-system and can't exploit any advantages that the other two proposals do. A minor disadvantage voices is the fact that the pristine files remain transparent to the users and may potentially encourage unsupported manipulations.
2) A custom file format holds the promise of supporting an arbitrary number of requirements, is self-contained, extensibility and flexibility. The implementation may be incrementally improved to add new features and operations that yield improved performance and/or disk savings. Once we have a custom format, we can sort and combine files before compression to exploit inter-file similarities. This is shown to yield significant savings without adding too much complexity (see references for numbers). The major critique of this approach is that of the overhead, risks and complexity associated with implementing and maintaining a custom file format of release grade. If the benefits are doubtful to justify this overhead, then we should forgo going this route.
3) Sqlite has a very reputable code-base and performance, in addition to already being utilized by SVN. A proposal to use it for small pristine file storage has been proposed. The major advantage is the possibility of abusing and/or overloading Sqlite with this kind of usage that it probably isn't optimized to handle. In addition, if the database file increases too much, performance and disk usage may deteriorate and require costly maintenance passes to improve them. Sqlite will not handle large file, which will be stored separately on disk, this is similar to the custom file format case where large files will end up not sharing other files in the pack file they are in.
::Conclusion::
Regardless of what approach we take, it'll most probably feature two properties: incremental implementation and benchmarking. The simplest approach could be taken first, keeping in mind that we need to collect more data and perform rigorous testing to ensure stability and reliability. In-place compression while very easily attainable in implementation, is very limited and will serve only the smaller WC's with large average file-size. Sqlite holds a great promise that should be explored. Where the cutoff for small files are, what page-size should we choose and other Sqlite configuration details that may affect performance is subject to further research. Creating a custom file format that is simple, yet powerful enough to give us flexibility is still a very exciting possibility. One that should probably be explored if for nothing other than research and comparison. Sqlite can be used as a first implementation and the simplest working pack-file
implementation may be added for comparison and experimentation.
Thank you for reading. Please share your opinion, notes and concerns.
[1] https://docs.google.com/document/d/1ktIsewfMBMVBxbn-Ng8NwkNwAS_QJ6eC7GOygsbBeEc/edit
[2] Since pristines are stored using SHA-1 hash, identical files are stored only once.
[3] http://mail-archives.apache.org/mod_mbox/subversion-dev/201203.mbox/%3C1332695820.9245.YahooMailNeo@web161401.mail.bf1.yahoo.com%3E
[4] http://svn.haxx.se/dev/archive-2012-03/0573.shtml
[5] http://svn.haxx.se/dev/archive-2012-03/0578.shtml
[6] Tested trunks were SVN, GCC, WebKit, OOO and WP late March 2012.
[7] Files on which compression doesn't reduce them by multiples of block size don't shrink on disk. Therefore, files smaller than a single block can never be shrunk more, even with the best compression algorithms.
[8] These savings are due to inter-file similarities, sorting (exploits statistical similarities between same-type files) and avoiding sub-block waste. The latter has the biggest effect on WC's with small average file-sizes while sorting has the least effect in the order of single-digit percentage improvement.
-Ash
Re: AW: Compressed Pristines (Call for Vote)
Posted by Greg Stein <gs...@gmail.com>.
On Tue, Mar 27, 2012 at 15:29, Branko Čibej <br...@apache.org> wrote:
> On 27.03.2012 17:29, Markus Schaber wrote:
>...
>> That's an easy one: When the compressed file (including gzip-headers etc.) is not smaller than the original file, store it uncompressed. This can be enhanced with some percentage or watermark value (e. G. we need at least a reduction of 42 bytes or 2%).
Actually, I would suggest that any file that has an *original* size of
<8k (or some other cutoff), then it just goes into SQLite. Maybe we
compress it in memory, and store the result (since we can't stream the
compression into a SQLite row).
What I'd like to avoid is compress-first, *then* examining the size.
Especially where that operation takes place on disk.
If we say "oh. larger than 8k. compress streamily onto disk." And
conversely we say, "less than 8k. compress into memory. store in
SQLite."
>...
> There are much better ways, e.g., using file(1) or mime.magic (IIRC we
> already have code for the latter), methods that actually look at the
> file contents. Most compressed file formats will have a well-known
> header, or some other discriminating mark (not file name/extension, I
> might add) that's fairly cheap to check, and is good enough to be at
> least an initial rough filter.
Yup. Please see include/private/svn_magic.h. Stefan dropped that in a
while back.
I'd suggest we use it before *any* compression (whether into memory or
onto disk). We can then hard-code certain mime types that are
compressable (or not). *Maybe* provide some escape hatches via
configuration (but y'll know how I hate more user knobs).
Cheers,
-g
Re: AW: Compressed Pristines (Call for Vote)
Posted by Branko Čibej <br...@apache.org>.
On 27.03.2012 17:29, Markus Schaber wrote:
> Hello, Branko,
>
>> Von: Branko Čibej [mailto:brane@xbc.nu] Im Auftrag von Branko Cibej
>>>> As others have pointed out, the only cases where compression and
>>>> packing may cause trouble is working copies with a lot of binary,
>>>> compressed files (.jars, various image formats, etc.) That's a
>>>> problem that needs solving regardless of the compression algorithm or
>>>> pack format.
>>> This can be handled with a not-compressed flag and storing the data as-
>>> is.
>> You're jumping a couple steps here, the first two obviously being, a),
>> identify which file formats should not be compressed, and b) figure out
>> how to detect such files reasonably reliably.
> That's an easy one: When the compressed file (including gzip-headers etc.) is not smaller than the original file, store it uncompressed. This can be enhanced with some percentage or watermark value (e. G. we need at least a reduction of 42 bytes or 2%).
If you're willing to waste the compression time, yes. We do this on the
server side to find out if it's better to store a given version of a
file as a delta to a previous version, or as a fulltext. I was never too
happy about the price of backing out from a wrong assumption, however.
There are much better ways, e.g., using file(1) or mime.magic (IIRC we
already have code for the latter), methods that actually look at the
file contents. Most compressed file formats will have a well-known
header, or some other discriminating mark (not file name/extension, I
might add) that's fairly cheap to check, and is good enough to be at
least an initial rough filter.
(N.B., this kind of check could, at some later day, be used on the
server to optimize contents storage, too.)
-- Brane
AW: Compressed Pristines (Call for Vote)
Posted by Markus Schaber <m....@3s-software.com>.
Hello, Branko,
> Von: Branko Čibej [mailto:brane@xbc.nu] Im Auftrag von Branko Cibej
> >> As others have pointed out, the only cases where compression and
> >> packing may cause trouble is working copies with a lot of binary,
> >> compressed files (.jars, various image formats, etc.) That's a
> >> problem that needs solving regardless of the compression algorithm or
> >> pack format.
> > This can be handled with a not-compressed flag and storing the data as-
> > is.
> You're jumping a couple steps here, the first two obviously being, a),
> identify which file formats should not be compressed, and b) figure out
> how to detect such files reasonably reliably.
That's an easy one: When the compressed file (including gzip-headers etc.) is not smaller than the original file, store it uncompressed. This can be enhanced with some percentage or watermark value (e. G. we need at least a reduction of 42 bytes or 2%).
(When we use packing, then the difference of the container size with and without the file is to be compared.)
Best regards
Markus Schaber
--
___________________________
We software Automation.
3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50
Email: m.schaber@3s-software.com | Web: http://www.3s-software.com
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects
Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915
Re: Compressed Pristines (Call for Vote)
Posted by Branko Čibej <br...@apache.org>.
On 27.03.2012 12:14, Bert Huijben wrote:
> A file that is only keyed by its SHA-1 will never grow or shrink.
Doh. I'm stupid this early in the morning. Of course you're right, this
is a non-issue.
-- Brane
RE: Compressed Pristines (Call for Vote)
Posted by Bert Huijben <be...@qqmail.nl>.
> -----Original Message-----
> From: Branko Čibej [mailto:brane@xbc.nu] On Behalf Of Branko Cibej
> Sent: dinsdag 27 maart 2012 2:56
> To: Subversion Development
> Subject: Re: Compressed Pristines (Call for Vote)
>
> [this should really be on the dev@ list, i mis-addressed my response.]
>
> On 26.03.2012 17:48, Ashod Nakashian wrote:
> >>
> >> I recommended a two-stage approach to the implementation because
> >> (packing and) encrypting the pristines is only half the story, there
> >> are a number of interactions with the rest of the system that need to
> >> be ironed out, and it makes no sense to take on the most complex part
> >> of the storage format first.
> > I see. This isn't what I gathered previously.
>
> I don't /know/ what interactions there are, but it would certainly help
> to find out (by running the test suite with the simplest possible
> compressed-pristine implementation, for example).
>
> >> As others have pointed out, the only cases where compression and
> >> packing may cause trouble is working copies with a lot of binary,
> >> compressed files (.jars, various image formats, etc.) That's a problem
> >> that needs solving regardless of the compression algorithm or pack
> >> format.
> > This can be handled with a not-compressed flag and storing the data as-is.
>
> You're jumping a couple steps here, the first two obviously being, a),
> identify which file formats should not be compressed, and b) figure out
> how to detect such files reasonably reliably. Using svn:mime-type as the
> determinator is not the answer, because I can set that to anything I
> like regardless of actual file contents. My advice here is to
> incorporate the flag in the wc.db, but not do the actual detection and
> special handling in the first release.
>
> > My only issue with the database-as-storage is that it won't work for
> > large files and if we store large files directly on disk, then we'll
> > have to split the storage, which isn't really great.
>
> It is, in fact, really great. Filesystems are typically much better at
> storing large files than any contrived packed-file format. Databases are
> typically much better at storing small files than most filesystems. To
> get the most benefit for the least effort, use both.
>
> > Consider a file just around the cut-off for storing in a database that gets
> moved between the database and disk between modifications that results in the
> file crossing the cut-off.
>
> Then don't make the cutoff a hard limit. For example, if a file is
> already on disk, don't store it in the database until it shrinks to
> below 75% of the limit. Conversely, don't push it out to the filesystem
> until it grows to perhaps even 200% of the limit.
A file that is only keyed by its SHA-1 will never grow or shrink. I don't think we have to discuss this part right now.
We moved away from using a pristine file per working copy file in 1.7 and I don't think we want to move back to that system.
When a file changes it becomes a new file, or we must open a completely new design where we also store just the changes for certain files.
Bert
Re: Compressed Pristines (Call for Vote)
Posted by Branko Čibej <br...@e-reka.si>.
[this should really be on the dev@ list, i mis-addressed my response.]
On 26.03.2012 17:48, Ashod Nakashian wrote:
>>
>> I recommended a two-stage approach to the implementation because
>> (packing and) encrypting the pristines is only half the story, there
>> are a number of interactions with the rest of the system that need to
>> be ironed out, and it makes no sense to take on the most complex part
>> of the storage format first.
> I see. This isn't what I gathered previously.
I don't /know/ what interactions there are, but it would certainly help
to find out (by running the test suite with the simplest possible
compressed-pristine implementation, for example).
>> As others have pointed out, the only cases where compression and
>> packing may cause trouble is working copies with a lot of binary,
>> compressed files (.jars, various image formats, etc.) That's a problem
>> that needs solving regardless of the compression algorithm or pack
>> format.
> This can be handled with a not-compressed flag and storing the data as-is.
You're jumping a couple steps here, the first two obviously being, a),
identify which file formats should not be compressed, and b) figure out
how to detect such files reasonably reliably. Using svn:mime-type as the
determinator is not the answer, because I can set that to anything I
like regardless of actual file contents. My advice here is to
incorporate the flag in the wc.db, but not do the actual detection and
special handling in the first release.
> My only issue with the database-as-storage is that it won't work for
> large files and if we store large files directly on disk, then we'll
> have to split the storage, which isn't really great.
It is, in fact, really great. Filesystems are typically much better at
storing large files than any contrived packed-file format. Databases are
typically much better at storing small files than most filesystems. To
get the most benefit for the least effort, use both.
> Consider a file just around the cut-off for storing in a database that gets moved between the database and disk between modifications that results in the file crossing the cut-off.
Then don't make the cutoff a hard limit. For example, if a file is
already on disk, don't store it in the database until it shrinks to
below 75% of the limit. Conversely, don't push it out to the filesystem
until it grows to perhaps even 200% of the limit.
> It's not as clean as having a file-format that handles all cases for us. Sure it'll take longer to get release-quality code, but
But?
> it'd be the correct way of doing things,
Oh nonsense. "Correct" is what works best in a given situation and is
most maintainable, not what generates the best research papers.
> won't feel hackish and will serve us in the long-run better.
I dislike hand-waving arguments, so you'll have to substantiate this one
about serving us better in the long run to convince me. All I see here
is an acute case of NIH syndrome.
> My only similar solid example is Git. I don't know how much effort went into their system, but I'm sure we can do this and do it right. If I were to choose between 6 months to release without packed-files and 12-15 months with them, I'd choose the latter. At least that's how I see it.
The point is that you can have a working, stable implementation using
off-the-shelf code (filesystem and database) in a few weeks, and it does
not stop you from going on to inventing a packed-file format that is
nevertheless friendly to deletions.
(Just for the record though: If you can do that and make it perform
better than SQLite in less than a year, I'll eat my hat.)
-- Brane