You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Malcolm Rowe <ma...@farside.org.uk> on 2007/03/13 12:00:50 UTC

Sharded FSFS repositories - summary

Here's a summary of the discussions about sharding FSFS repositories,
and what I'd like to do for 1.5.0.

Generally, everyone seems to like the idea.  However, no-one wanted to
be forced to pick a shard size, and it didn't look like anyone actually
wanted the size to be configurable either ("the fewer decisions that
have to be made at repository creation time the better").  Nobody liked
the configuration scheme as a way of storing the shard size.

Regarding whether it should be the default for 1.5-created filesystems:

Mattias Engdegård made the point that it's unlikely that we'd see a
difference between the two formats with a decent (tree-based) filesystem
(so there's no real reason to not go with the sharded format as the
default).  Karl also wants it to be the default format.

Greg preferred not making it the default until 1.6, so that tools that
read the repository directly (e.g. previous versions of Subversion) had
time to be updated.  I'm not convinced by this argument, particularly
because we already did it in 1.4 with svndiff1 support, and I didn't see
anyone complaining.


There was some discussion about whether we should consider alternate
sharding schemes to the one I originally posted (r12345 goes into
revs/N/12345 where N = 12345/constant).  I'm not particular in favour of
anything more complicated unless someone can prove that it actually
makes a difference.  I also like keeping the full revision name around -
it allows us to ensure that we can always uniquely identify each
revision just by the basename.


Conversion:
Greg suggested we create a tool to do an offline reorganisation of the
repository.  This should actually be pretty fast.

Karl would like us to auto-upgrade repositories by default.  We _can_ do
that, but only if the repository administrator is first able to exclude
all old readers (i.e. bump the format and then ensure that all older
clients have finished reading).  I quite like the idea, but I'm not sure
the complexity is worthwhile if we can provide a quick offline upgrade
tool.


So, here's my plan so far.  Any comments?

- For 1.5, FSFS repositories will be created as sharded by default.
  We'll bump the FSFS format number from 2 to 3 (meaning: can have
  svndiff1, sharded).

- We'll create shards of 4000 entries each.  That's large enough that
  someone would have to hit 16M revisions before a larger value would be
  an improvement, but small enough that it has reasonable performance
  (and support) on all filesystems that I'm aware of.  It's also a
  power-of-ten, so easier for humans to understand.

- The revision files will be named according to the scheme I posted
  earlier, and shards created on-demand.

- We'll add a --pre-1.5-compatible flag to svnadmin (and the equivalent
  to the fs-config hash), which will create FSFS filesystems with format
  2 by default, and be a no-op for BDB filesystems.  --pre-1.4-compatible
  will also imply --pre-1.5-compatible.

- We'll create a tool to do an offline upgrade between formats 2 and 3
  (it'll run _much_ faster than a dump/load, and the people who'd benefit
  most from this change are also the ones that can least allow time for
  a dump/load).  Since FSFS has no way to lock out readers, we'll have
  to ask the repository administrator to make sure there aren't any.

Regards,
Malcolm

Re: Sharded FSFS repositories - summary

Posted by Michael Sinz <Mi...@sinz.org>.
Matthias Wächter wrote:
> On 13.03.2007 13:47, Ph. Marek wrote:
>>> - We'll create shards of 4000 entries each.  That's large enough that
>>>   someone would have to hit 16M revisions before a larger value would be
>>>   an improvement, but small enough that it has reasonable performance
>>>   (and support) on all filesystems that I'm aware of.  It's also a
>>>   power-of-ten, so easier for humans to understand.
>> 4000 is no (integer) power of ten, so would not really be better.
>> Quick, in which directory is revision 421712? (see KDEs repository)
>>
>> If I understand you correctly, you want to have
>>     0/1
>>     0/2
>>     0/3
>>     ...
>>     0/3999
>>     1/4000
>>     1/4001
>>     ...
>>     2/8000
>> and so on. Right?
>>
>> I'd prefer to have a *real* (integer :-) power of ten, eg. 1000. And 
>> TBH, 4000 is a bit too much (for me, at least) - 1000 would be high, 
>> but acceptable.
>> (I'd really prefer 100 and 3 or 4 levels - but I seem to be alone with 
>> that.)
> 
> 
> How about:
> 
>     0/
>     1/1
>     2/2
>     3/3
>     ...
>     3999/3999
>     0/4000
>     1/4001
>     ...
>     3999/7999
>     0/8000
> 
> and so on?

The problem with this is that you don't get the "stable" or "read-only" bit
of the directory tree.  On large systems, being able to easily put part of the
repository (older bit) onto tier-2 or tier-3 storage systems or even onto
read-only archival storage systems can be very powerful.  For example, with
Apache, they could easily put the first 300,000 revisions onto a slower R/O
storage device and never actually notice the performance difference.

(Tier-1 storage is much more costly than the tier-2/tier-3 SAN storage)

Also, having the data in archival storage reduces backup costs too (tier-1
SAN flash-copy requires a second storage area of the same size, and if that
size can be less, the flash-copy backup is also smaller and thus major
cost savings - plus many SAN flash backup systems are licensed on a storage
size basis, with the costs going up as the storage size goes up)

> Disadvantage 1: All top-level directories are created before the 4000th 
> revision, you don't see the repository "grow up" on the top level by 
> numbers of sub-directories.
> 
> Disadvantage 2: You cannot take "finished" directories to put them on 
> non-backuped storage space (considering good archive for it), since each 
> directory may receive new files every now and then.

See above...

> I like the idea of having the divisor be a power of 10 (or let the 
> revision stored in hex? Then take 4096 which is 3-digit hex :)).
> 
> Beside that, multiple levels would be fine, too, and could reduce the 
> impact of Disadvantage 2 from above. I would suggest having the 
> top-level directories being used in a round-robin fashin for throughput 
> maximization, the second level would be used according to the base 
> proposal:

Again, the top-level is where the best win is for archival behaviors.
Also, what throughput maximization?  If most operations happen in the last
20 revisions or so, over all performance would be best if those 20
revisions are in the *same* directory and not different ones.  The OS
and filesystem are much more likely to have cached everything you need
when dealing within a smaller set of directories.  (Locality of reference
is usually a benefit)

If you want to get more performance, a better disk subsystem and more RAM
is the way to go (and filesystem/OS that can make use of those resources)

[...]

> Of course, this all only makes sense if there is a performance benefit 
> for splitting sequential accesses over multiple storage spaces.

In general, a SAN or good RAID setup with a filesystem that knows how to
really push the hardware will beat having the mounted directories across
different filesystems.  The reduction in metadata caching requirements
and locking requirements alone may prove to provide the win here.

-- 
Michael Sinz                     Technology and Engineering Director/Consultant
"Starting Startups"                                mailto:michael.sinz@sinz.org
My place on the web                            http://www.sinz.org/Michael.Sinz

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

Re: Sharded FSFS repositories - summary

Posted by Matthias Wächter <ma...@tttech.com>.
On 13.03.2007 13:47, Ph. Marek wrote:
>> - We'll create shards of 4000 entries each.  That's large enough that
>>   someone would have to hit 16M revisions before a larger value would be
>>   an improvement, but small enough that it has reasonable performance
>>   (and support) on all filesystems that I'm aware of.  It's also a
>>   power-of-ten, so easier for humans to understand.
> 4000 is no (integer) power of ten, so would not really be better.
> Quick, in which directory is revision 421712? (see KDEs repository)
> 
> If I understand you correctly, you want to have
>     0/1
>     0/2
>     0/3
>     ...
>     0/3999
>     1/4000
>     1/4001
>     ...
>     2/8000
> and so on. Right?
> 
> I'd prefer to have a *real* (integer :-) power of ten, eg. 1000. And TBH, 4000 
> is a bit too much (for me, at least) - 1000 would be high, but acceptable.
> (I'd really prefer 100 and 3 or 4 levels - but I seem to be alone with that.)


How about:

	0/
	1/1
	2/2
	3/3
	...
	3999/3999
	0/4000
	1/4001
	...
	3999/7999
	0/8000

and so on?

Advantage: One could store each directory on a separate storage devices probably increasing bandwidth since revisions are typically read sequentially in number. (Q: Is this true? Or is this presuming a pipelined file access that is not yet implemented?)

Disadvantage 1: All top-level directories are created before the 4000th revision, you don't see the repository "grow up" on the top level by numbers of sub-directories.

Disadvantage 2: You cannot take "finished" directories to put them on non-backuped storage space (considering good archive for it), since each directory may receive new files every now and then.

I like the idea of having the divisor be a power of 10 (or let the revision stored in hex? Then take 4096 which is 3-digit hex :)).

Beside that, multiple levels would be fine, too, and could reduce the impact of Disadvantage 2 from above. I would suggest having the top-level directories being used in a round-robin fashin for throughput maximization, the second level would be used according to the base proposal:

	0/
	1/0/1
	2/0/2
	3/0/3
	...
	9/0/9
	0/0/10
	...
	9/0/9999
	0/1/10000
	...
	9/1/19999
	0/2/20000

and so on.

In this scheme, I only have 10 top-level directories (easier to split over multiple disks) and one sub-directories in each of them with each step of 10,000 revisions, but each directory only containing 1,000 revisions. With each step of 10,000 revisions all "finished" second-level directories could be excluded from subsequent backups.

Of course, this all only makes sense if there is a performance benefit for splitting sequential accesses over multiple storage spaces.

- Matthias

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

Re: Sharded FSFS repositories - summary

Posted by John Szakmeister <jo...@szakmeister.net>.
Malcolm Rowe wrote:
> On Wed, Mar 14, 2007 at 08:54:14AM +0100, Ph. Marek wrote:
>> On Tuesday 13 March 2007 15:34, Malcolm Rowe wrote:
>>> But neither of those are the main reason to do this.  (realistically,
>>> how many times a month will a typical admin do an 'ls' in revs/ ?)
>>>
>>> 4000 revs is a good compromise: it's big enough that it scales to large
>>> repositories (ASF's repository would be halfway towards needing another
>>> level if we went with 1000 files-per-shard), and it's small enough that
>>> it works everywhere we need it to (even on Coda, it seems :-)).
>> Well, with 4000 you don't know where r454513 is, do you?
> 
> Yes, you do, if you use a calculator.
> 
> Again, I'm not sure exactly what use case you're thinking about that
> requires admins to look for revision files so regularly :-)

It's not that it'll require them to look at them regularly.  It that 
when there is an issue, the admin needs to be able to track it down 
under stress... so it would be best if the mapping was more intuitive, 
and didn't require you to remember any magic numbers or a formula for 
computing the location.

-John

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

Re: Sharded FSFS repositories - summary

Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Wed, Mar 14, 2007 at 08:54:14AM +0100, Ph. Marek wrote:
> On Tuesday 13 March 2007 15:34, Malcolm Rowe wrote:
> > But neither of those are the main reason to do this.  (realistically,
> > how many times a month will a typical admin do an 'ls' in revs/ ?)
> >
> > 4000 revs is a good compromise: it's big enough that it scales to large
> > repositories (ASF's repository would be halfway towards needing another
> > level if we went with 1000 files-per-shard), and it's small enough that
> > it works everywhere we need it to (even on Coda, it seems :-)).
> Well, with 4000 you don't know where r454513 is, do you?

Yes, you do, if you use a calculator.

Again, I'm not sure exactly what use case you're thinking about that
requires admins to look for revision files so regularly :-)

> > It doesn't look like multi-level trees would be needed for performance
> > until you hit somewhere around c.100M revisions, and I'm not aware of
> > anyone who's anywhere near that level yet :-)
> As you said above, ASF (and KDE) are about to get a million revisions ... so 
> with 1000 three levels would be better.
> 

Well, it does obviously depend upon the number of child entries you
restrict each directory to holding.  I don't yet have hard numbers
to inform me about what the typical characteristics are for various
filesystems - I'm working on that now.

> > Sure, but it's the complexity that concerns me - we really need to
> > demonstrate a tangible benefit to make it that much more complex.
> Ok.

(Karl did point out that sticking the magic number in the file makes it
possible to change it later, so that's one obvious benefit.)

> > > Have you seen my mail regarding the transaction-directories? Maybe the
> > > naming there could be done with the same function.
> > They could, but how frequently do you commit transactions with 100,000
> > changed files?  Maybe on an initial import, but in that case the time
> > spent writing the data is going to dwarf the time spent looking up the
> > entries, or at least that's my intuition.  You're quite welcome to
> > benchmark the difference to see what it actually is.
> I did, some time ago.
> 
> As a side note: just a "dpkg-query -L <packages>" of the changed packages in 
> debian-unstable (from yesterday to today) gives 2638 lines. That includes 
> directories -- which are not files -- but they have properties too, like 
> normal files.
> So if you dist-upgrade only once a week, you're likely to get 10 000 files 
> changed.
> 

This seems like rather an odd use case.  But anyway, even with 10,000
files, I'm not sure that you'll see any real slowdown.  Like I said, I'm
trying to quantify that now.

Regards,
Malcolm

Re: Sharded FSFS repositories - summary

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Tuesday 13 March 2007 15:34, Malcolm Rowe wrote:
...
> But neither of those are the main reason to do this.  (realistically,
> how many times a month will a typical admin do an 'ls' in revs/ ?)
>
> 4000 revs is a good compromise: it's big enough that it scales to large
> repositories (ASF's repository would be halfway towards needing another
> level if we went with 1000 files-per-shard), and it's small enough that
> it works everywhere we need it to (even on Coda, it seems :-)).
Well, with 4000 you don't know where r454513 is, do you?
As I said, I'd prefer an integer power-of-ten.

> It doesn't look like multi-level trees would be needed for performance
> until you hit somewhere around c.100M revisions, and I'm not aware of
> anyone who's anywhere near that level yet :-)
As you said above, ASF (and KDE) are about to get a million revisions ... so 
with 1000 three levels would be better.

> > If this number would go into an existing file (format, fs-type), it would
> > not require another read;
>
> Sure, but it's the complexity that concerns me - we really need to
> demonstrate a tangible benefit to make it that much more complex.
Ok.

> > and if we allowed not one, but two such numbers here,
> > the repository could be re-arranged on-line.
> > (The fs-layer had to be looking for both files until one was found - as
> > was already recommended).
> Why would you ever need to do something like that?
>
> (What Karl recommended was online conversion from the 'flat' to
> 'sharded' scheme, which I still think is too complex for the slight
> benefit [of having a slightly faster upgrade] it gives).
For on-line rearrangement. That may be a seldom used operation - but just for 
the big repositories it should be as painless as possible.
And if you already look for two paths (with/without sharding), you might as 
well look for 2 sharded.

> > Have you seen my mail regarding the transaction-directories? Maybe the
> > naming there could be done with the same function.
> They could, but how frequently do you commit transactions with 100,000
> changed files?  Maybe on an initial import, but in that case the time
> spent writing the data is going to dwarf the time spent looking up the
> entries, or at least that's my intuition.  You're quite welcome to
> benchmark the difference to see what it actually is.
I did, some time ago.
Testing ext3 with or without dir-index against bdb for a large number of files 
(10 000 or more) showed bdb to be the fastest.
Whether that's because bdb is a bit better with file handling (deltification 
*after commit, IIRC?) or just because the number of files is much smaller, I 
can't say.

The difference between ext3 without dir-index and bdb was: bdb finished in 3 
hours, ext3 got killed after 12 without having finished.
ext3 with dir-index? Don't recall, maybe 4 hours.


As a side note: just a "dpkg-query -L <packages>" of the changed packages in 
debian-unstable (from yesterday to today) gives 2638 lines. That includes 
directories -- which are not files -- but they have properties too, like 
normal files.
So if you dist-upgrade only once a week, you're likely to get 10 000 files 
changed.


Regards,

Phil

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

Re: Sharded FSFS repositories - summary

Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Tue, Mar 13, 2007 at 01:47:06PM +0100, Ph. Marek wrote:
> On Tuesday 13 March 2007 13:00, Malcolm Rowe wrote:
> > - We'll create shards of 4000 entries each.  That's large enough that
> >   someone would have to hit 16M revisions before a larger value would be
> >   an improvement, but small enough that it has reasonable performance
> >   (and support) on all filesystems that I'm aware of.  It's also a
> >   power-of-ten, so easier for humans to understand.
> 4000 is no (integer) power of ten, so would not really be better.

Okay, I didn't use the right word :-)  It's still easier for humans to
grasp how a range from 420000-423999 works than one that ranges from
417792-421887.

> I'd prefer to have a *real* (integer :-) power of ten, eg. 1000. And TBH, 4000 
> is a bit too much (for me, at least) - 1000 would be high, but acceptable.
> (I'd really prefer 100 and 3 or 4 levels - but I seem to be alone with that.)

The change is for two main reasons:
 - making it work on filesystems that have a maximum number of entries
   per directory (e.g. some filesystems, some NAS boxes).
 - slightly improving performance on filesystems with sub-optimal handling
   of many files in one directory (typically not until you hit 100k revs
   or so).

There are other advantages too:
 - reducing spew when administrators list the contents of the revs/ directory.
 - allowing blocks of revisions to be moved off in one go.

But neither of those are the main reason to do this.  (realistically,
how many times a month will a typical admin do an 'ls' in revs/ ?)

4000 revs is a good compromise: it's big enough that it scales to large
repositories (ASF's repository would be halfway towards needing another
level if we went with 1000 files-per-shard), and it's small enough that
it works everywhere we need it to (even on Coda, it seems :-)).

It doesn't look like multi-level trees would be needed for performance
until you hit somewhere around c.100M revisions, and I'm not aware of
anyone who's anywhere near that level yet :-)

> If this number would go into an existing file (format, fs-type), it would not 
> require another read;

Sure, but it's the complexity that concerns me - we really need to
demonstrate a tangible benefit to make it that much more complex.

> and if we allowed not one, but two such numbers here, 
> the repository could be re-arranged on-line.
> (The fs-layer had to be looking for both files until one was found - as was 
> already recommended).

Why would you ever need to do something like that?

(What Karl recommended was online conversion from the 'flat' to
'sharded' scheme, which I still think is too complex for the slight
benefit [of having a slightly faster upgrade] it gives).

> Have you seen my mail regarding the transaction-directories? Maybe the naming 
> there could be done with the same function.
> 

They could, but how frequently do you commit transactions with 100,000
changed files?  Maybe on an initial import, but in that case the time
spent writing the data is going to dwarf the time spent looking up the
entries, or at least that's my intuition.  You're quite welcome to
benchmark the difference to see what it actually is.

Regards,
Malcolm

Re: Sharded FSFS repositories - summary

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Tuesday 13 March 2007 13:00, Malcolm Rowe wrote:
> Here's a summary of the discussions about sharding FSFS repositories,
> and what I'd like to do for 1.5.0.
>
> Generally, everyone seems to like the idea.  However, no-one wanted to
> be forced to pick a shard size, and it didn't look like anyone actually
> wanted the size to be configurable either ("the fewer decisions that
> have to be made at repository creation time the better"). 
... 
> So, here's my plan so far.  Any comments?
...
> - We'll create shards of 4000 entries each.  That's large enough that
>   someone would have to hit 16M revisions before a larger value would be
>   an improvement, but small enough that it has reasonable performance
>   (and support) on all filesystems that I'm aware of.  It's also a
>   power-of-ten, so easier for humans to understand.
4000 is no (integer) power of ten, so would not really be better.
Quick, in which directory is revision 421712? (see KDEs repository)

If I understand you correctly, you want to have
    0/1
    0/2
    0/3
    ...
    0/3999
    1/4000
    1/4001
    ...
    2/8000
and so on. Right?

I'd prefer to have a *real* (integer :-) power of ten, eg. 1000. And TBH, 4000 
is a bit too much (for me, at least) - 1000 would be high, but acceptable.
(I'd really prefer 100 and 3 or 4 levels - but I seem to be alone with that.)

So naturally I'd like to have an option to specify that on creation time.

If this number would go into an existing file (format, fs-type), it would not 
require another read; and if we allowed not one, but two such numbers here, 
the repository could be re-arranged on-line.
(The fs-layer had to be looking for both files until one was found - as was 
already recommended).


> - The revision files will be named according to the scheme I posted
>   earlier, and shards created on-demand.
...
+1

Have you seen my mail regarding the transaction-directories? Maybe the naming 
there could be done with the same function.


Thank you!


Regards,

Phil

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

Re: Sharded FSFS repositories - summary

Posted by Peter Lundblad <pl...@google.com>.
Malcolm Rowe writes:
> So, here's my plan so far.  Any comments?
> 
I like this plan. +1.

Thanks,
//Peter

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

Re: Sharded FSFS repositories

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Tuesday 20 March 2007 15:26, John Peacock wrote:
> Malcolm Rowe wrote:
> > My results:
> > - With one exception, sharding is always more expensive than not
> >   sharding (because it adds an extra directory lookup).  The difference
> >   is negligible, however, because we're still talking about microseconds
> >   per lookup.
> Thank you for taking the time to benchmark something, rather than
> relying on Magic Numbers (something I'm severely allergic to). ;-)
Yes, thank you very much.

Regarding your numbers - I think that linux might be a bad candidate, because 
(as you said) it makes no difference as long as everything is cached.
I don't believe that the loopback mount makes *any* difference - the dentry 
cache is the same.

Perhaps on a loaded system sharding would help, because a lot of dentries 
could be evicted - on a single directory that could be much harder.


> > - We'll create shards of 1000 entries each.  Anyone who has a repository
> >   that's larger than a million revisions will likely be running on a
> >   decent filesystem.  Even if they aren't, we will still be much better
> >   than we were before.
>
> I concur that this is a reasonable course.  Malcolm++
+1 to both of you ;-)


Malcolm, thank you!


Regards,

Phil

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

Re: Sharded FSFS repositories

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
On Thursday 22 March 2007 19:37, Kevin Greiner wrote:
> 2^12 is the number of opens, not the number of files. Look at the last line
> of the logs I posted earlier inside the zip file. That's where I copied the
> those numbers from.
Sorry, I must have missed the log files - the 25ms is *per open*, not for all 
open operations together.

> > results
> > ... which Windows is that? Are you sure that you really have 1 024 076
> > files in
> > this directory?
> Yes, I'm certain there are 2^20 zero-byte files in the directory. Look at
> line 9 of the create script. Also, it took roughly 10 minutes to create the
> files and another 10 minutes to delete them. It doesn't take that long to
> delete 1024 files. Looking at this directory in Explorer is painful. I
> tried once and gave up. Thankfully svn doesn't have to enumerate the
> contents. I too expected to see worse results than this. As was noted
> elsewhere, the bottleneck must be Explorer and not NTFS.
Well, with 25ms per open it really doesn't matter whether sharded or not.


Kevin, thank you very much!


Regards,

Phil

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

Re: Sharded FSFS repositories

Posted by Kevin Greiner <gr...@gmail.com>.
On 3/22/07, philipp.marek@bmlv.gv.at <ph...@bmlv.gv.at> wrote:
>
> > My goal was to recreate what Malcolm had done based solely on his
> > description above. But some of your ideas were interesting although they
> > don't appear match what Malcolm has done.
> Thank you.
>
> > OK, I did that. The summary: no change. NTFS appears to be just as fast
> for
> > this scenario as any other modern filesystem.
> >
> > Across 1024 file opens in a directory of 2^20 files, an average time
> > (seconds) of 0.025 for not-sharded and 0.026 for sharded. See the
> attached
> > scripts and log files for the details. I ran the read script three
> times,
> > recording the 3rd iteration's time to minimize the impact of my slower
> > laptop.
> Your script has 2^12, which is 4096, in it.
> Just out of interest: Could you post the complete log?


2^12 is the number of opens, not the number of files. Look at the last line
of the logs I posted earlier inside the zip file. That's where I copied the
those numbers from.

Also, you can also see from line 62 of the read script that the total time
is divided by the loop counter. Also, note the file names: these are created
by a loop counter so a filename of 922987.txt means that it was the
922,987th file to be created in that directory (for non-sharded, of course).

Dividing with 2^10 I get 25µs per open. I have seen completely different
> results
> ... which Windows is that? Are you sure that you really have 1 024 076
> files in
> this directory?


Yes, I'm certain there are 2^20 zero-byte files in the directory. Look at
line 9 of the create script. Also, it took roughly 10 minutes to create the
files and another 10 minutes to delete them. It doesn't take that long to
delete 1024 files. Looking at this directory in Explorer is painful. I tried
once and gave up. Thankfully svn doesn't have to enumerate the contents. I
too expected to see worse results than this. As was noted elsewhere, the
bottleneck must be Explorer and not NTFS.

Anyone else want to take a crack at running these scripts on NTFS to check
my numbers?

I'm running Windows XP Pro fully patched on a Dell Inspiron 8600 P-M
1.7GHzwith 2GB RAM and a 7200 100GB IDE hard disk. And I was using my
system for
other light-duty stuff like checking email, browsing the web, etc.

Re: Sharded FSFS repositories

Posted by ph...@bmlv.gv.at.
> My goal was to recreate what Malcolm had done based solely on his
> description above. But some of your ideas were interesting although they
> don't appear match what Malcolm has done.
Thank you.

> OK, I did that. The summary: no change. NTFS appears to be just as fast for
> this scenario as any other modern filesystem.
>
> Across 1024 file opens in a directory of 2^20 files, an average time
> (seconds) of 0.025 for not-sharded and 0.026 for sharded. See the attached
> scripts and log files for the details. I ran the read script three times,
> recording the 3rd iteration's time to minimize the impact of my slower
> laptop.
Your script has 2^12, which is 4096, in it.
Just out of interest: Could you post the complete log?
Dividing with 2^10 I get 25�s per open. I have seen completely different results
... which Windows is that? Are you sure that you really have 1 024 076 files in
this directory?


Thank you for your efforts!


Regards,

Phil



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

Re: Sharded FSFS repositories

Posted by Kevin Greiner <gr...@gmail.com>.
On 3/22/07, Ph. Marek <ph...@bmlv.gv.at> wrote:

> I don't really know VBscript, but there are some things I notice:


My goal was to recreate what Malcolm had done based solely on his
description above. But some of your ideas were interesting although they
don't appear match what Malcolm has done.

- You open the file that you just created *and still have opened*.
>   Maybe the lookups should be done in a second loop and/or another script.

- IIRC Win32 still uses timers (with HZ=150?), so you'll get time readings
>   only with 7ms granularity.
>   So it might be better to do 1000 lookups and measure their cumulative
> time,
>   with different numbers of entries in the directories.
>
> > Does that change the conclusion at all?
> Could you please create the files, and try to access some (in *random*
> order)
> in another script?


OK, I did that. The summary: no change. NTFS appears to be just as fast for
this scenario as any other modern filesystem.

Across 1024 file opens in a directory of 2^20 files, an average time
(seconds) of 0.025 for not-sharded and 0.026 for sharded. See the attached
scripts and log files for the details. I ran the read script three times,
recording the 3rd iteration's time to minimize the impact of my slower
laptop.

Re: Sharded FSFS repositories

Posted by "Ph. Marek" <ph...@bmlv.gv.at>.
Hello Kevon,

On Wednesday 21 March 2007 18:42, Kevin Greiner wrote:
> I wrote a VBScript script this morning that basically, I think, duplicates
> what you did except on NTFS on Windows XP Pro on a laptop with a 7200rpm
> IDE hard disk. It creates 2^20 files and measure the performance of opening
> the file for reading every 1,000 files. (Rename attachment to have .vbs
> extension to run on Windows.)
>
> Most of the time, the duration was so small it didn't register with the
> VBScript Timer function. I did get several opens that output 0.0078125 sec
> or similar very small value.
I don't really know VBscript, but there are some things I notice:
- You open the file that you just created *and still have opened*.
  Maybe the lookups should be done in a second loop and/or another script.
- IIRC Win32 still uses timers (with HZ=150?), so you'll get time readings
  only with 7ms granularity.
  So it might be better to do 1000 lookups and measure their cumulative time,
  with different numbers of entries in the directories.

> Does that change the conclusion at all?
Could you please create the files, and try to access some (in *random* order) 
in another script?


Regards,

Phil

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

Re: Sharded FSFS repositories

Posted by Kevin Greiner <gr...@gmail.com>.
On 3/20/07, Malcolm Rowe <ma...@farside.org.uk> wrote:
>
>
> I created a 2GB file on my local (ext3) partition and created a variety
> of filesystems on it via a loopback mount.  I then mounted the new
> filesystem and created 2^20 empty files on it, measuring amortised
> open() time at various points.  I tested using the current scheme (all
> files in one directory) and the sharding-by-1000 scheme.
>
> I tested ext2, ext3 (with and without dirindexing), reiserfs, vfat, and
> hfsplus.  I wasn't able to test NTFS, unfortunately.


I wrote a VBScript script this morning that basically, I think, duplicates
what you did except on NTFS on Windows XP Pro on a laptop with a 7200rpm IDE
hard disk. It creates 2^20 files and measure the performance of opening the
file for reading every 1,000 files. (Rename attachment to have .vbs
extension to run on Windows.)

Most of the time, the duration was so small it didn't register with the
VBScript Timer function. I did get several opens that output 0.0078125 sec
or similar very small value.

Does that change the conclusion at all?

Re: Sharded FSFS repositories

Posted by John Peacock <jp...@rowman.com>.
Malcolm Rowe wrote:
> My results:
> - With one exception, sharding is always more expensive than not
>   sharding (because it adds an extra directory lookup).  The difference
>   is negligible, however, because we're still talking about microseconds
>   per lookup.

Thank you for taking the time to benchmark something, rather than 
relying on Magic Numbers (something I'm severely allergic to). ;-)

> - We'll create shards of 1000 entries each.  Anyone who has a repository
>   that's larger than a million revisions will likely be running on a
>   decent filesystem.  Even if they aren't, we will still be much better
>   than we were before.

I concur that this is a reasonable course.  Malcolm++

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

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

Re: Sharded FSFS repositories

Posted by Malcolm Rowe <ma...@farside.org.uk>.
At the risk of dragging this out even further, here's another RFC.

There were a lot of comments about whether the right size for a sharded
filesystem was 1000, 4000, or whatever.  Rather than rely on guesswork,
I've tried to measure the lookup time.

I created a 2GB file on my local (ext3) partition and created a variety
of filesystems on it via a loopback mount.  I then mounted the new
filesystem and created 2^20 empty files on it, measuring amortised
open() time at various points.  I tested using the current scheme (all
files in one directory) and the sharding-by-1000 scheme.

I tested ext2, ext3 (with and without dirindexing), reiserfs, vfat, and
hfsplus.  I wasn't able to test NTFS, unfortunately.

First, the problems with this approach:
- I'm mounting the filesystem loopback on another filesystem.
- I have no data in the files, so the filesystem fits entirely into my
  OS buffer cache.
- I'm only measuring average-case performance.

My results:
- With one exception, sharding is always more expensive than not
  sharding (because it adds an extra directory lookup).  The difference
  is negligible, however, because we're still talking about microseconds
  per lookup.
- Below 1024 files, lookup time was essentially constant.  At 2048 files
  and above, there was a small logarithmic increase, comparable to that
  incurred by adding sharding.
- With one exception, I saw virtually no appreciable difference in
  lookup time between a directory with 4096 files and one with 2^20.
  That may indicate a flaw in my methodology, since it wasn't what I
  expected.
- The sole exception to the above was vfat, which exhibited O(N) lookup
  lookup time and broke down completely after 32,768 files.  vfat had a
  similar lookup time to the other filesystem up to just over 1024
  files per directory.

I don't know whether my results are conclusive of anything other than
the codepath taken through the Linux filesystem drivers, but here's what
I'm going to do anyway:

> - For 1.5, FSFS repositories will be created as sharded by default.
>   We'll bump the FSFS format number from 2 to 3 (meaning: can have
>   svndiff1, sharded).
> 

- We'll create shards of 1000 entries each.  Anyone who has a repository
  that's larger than a million revisions will likely be running on a
  decent filesystem.  Even if they aren't, we will still be much better
  than we were before.

- We'll write out the filesystem organisation scheme to a file in the
  filesystem, so that the files-per-shard (or scheme) can change in the
  future.  We'll read that in at filesystem open time and cache it in
  the per-filesystem cached data: it'll be read at most once per process.

  + Anyone changing that file without a good understanding of what it
    does will win a broken filesystem.  I'm not about to protect people
    from stupid administrators.

> - The revision files will be named according to the scheme I posted
>   earlier, and shards created on-demand.
> 
> - We'll add a --pre-1.5-compatible flag to svnadmin (and the equivalent
>   to the fs-config hash), which will create FSFS filesystems with format
>   2 by default, and be a no-op for BDB filesystems.  --pre-1.4-compatible
>   will also imply --pre-1.5-compatible.
> 
> - We'll create a tool to do an offline upgrade between formats 2 and 3
>   (it'll run _much_ faster than a dump/load, and the people who'd benefit
>   most from this change are also the ones that can least allow time for
>   a dump/load).  Since FSFS has no way to lock out readers, we'll have
>   to ask the repository administrator to make sure there aren't any.
> 

Regards,
Malcolm

Re: Sharded FSFS repositories - summary

Posted by Karl Fogel <kf...@red-bean.com>.
Malcolm Rowe <ma...@farside.org.uk> writes:
>> Although the exact parameters may not be admin-configurable, will they
>> still be Subversion-configurable?  That is, will we store the magic
>> number "4000" somewhere on disk, so that if Subversion wants to
>> rejigger the numbers later (because we discover something, or because
>> someone blows past 16M revisions, or whatever) it can do so in a way
>> that it can detect at run-time?
>
> That's a good question.  I was planning on making it hard-coded, but I
> can easily stash it on disk if that's a better option.

Well, it'll be both: the value that you stash on disk will be
hardcoded, but if you find some other value on disk first, then use
that instead of the hardcoded value.

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

Re: Sharded FSFS repositories - summary

Posted by Malcolm Rowe <ma...@farside.org.uk>.
On Wed, Mar 14, 2007 at 12:50:41AM -0700, Karl Fogel wrote:
> Malcolm Rowe <ma...@farside.org.uk> writes:
> > - We'll create shards of 4000 entries each.  That's large enough that
> >   someone would have to hit 16M revisions before a larger value would be
> >   an improvement, but small enough that it has reasonable performance
> >   (and support) on all filesystems that I'm aware of.  It's also a
> >   power-of-ten, so easier for humans to understand.
> 
> Although the exact parameters may not be admin-configurable, will they
> still be Subversion-configurable?  That is, will we store the magic
> number "4000" somewhere on disk, so that if Subversion wants to
> rejigger the numbers later (because we discover something, or because
> someone blows past 16M revisions, or whatever) it can do so in a way
> that it can detect at run-time?
> 

That's a good question.  I was planning on making it hard-coded, but I
can easily stash it on disk if that's a better option.

Regards,
Malcolm

Re: Sharded FSFS repositories - summary

Posted by Karl Fogel <kf...@red-bean.com>.
Malcolm Rowe <ma...@farside.org.uk> writes:
> - We'll create shards of 4000 entries each.  That's large enough that
>   someone would have to hit 16M revisions before a larger value would be
>   an improvement, but small enough that it has reasonable performance
>   (and support) on all filesystems that I'm aware of.  It's also a
>   power-of-ten, so easier for humans to understand.

Although the exact parameters may not be admin-configurable, will they
still be Subversion-configurable?  That is, will we store the magic
number "4000" somewhere on disk, so that if Subversion wants to
rejigger the numbers later (because we discover something, or because
someone blows past 16M revisions, or whatever) it can do so in a way
that it can detect at run-time?

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

Re: Sharded FSFS repositories - summary

Posted by John Peacock <jp...@rowman.com>.
John Szakmeister wrote:
> I actually did this for NTFS (under VMware) using a python script.  I 
> posted my results earlier in this thread:
>   http://svn.haxx.se/dev/archive-2007-03/0134.shtml
> 
> FWIW, NTFS scales very badly.  

But performance from Explorer is not typical of performance for 
Subversion itself (i.e. M$loth made stupid decisions in the design of 
Explorer - e.g. scan every single file before returning).  A much better 
test would be a small script which would create many files and then time 
opening and reading those files both sequentially and "randomly" to see 
whether the underlying filesystem scaled well under different directory 
layouts.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

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

Re: Sharded FSFS repositories - summary

Posted by John Szakmeister <jo...@szakmeister.net>.
John Peacock wrote:
> Malcolm Rowe wrote:
>> - We'll create shards of 4000 entries each.  That's large enough that
>>   someone would have to hit 16M revisions before a larger value would be
>>   an improvement, but small enough that it has reasonable performance
>>   (and support) on all filesystems that I'm aware of.  It's also a
>>   power-of-ten, so easier for humans to understand.
> 
> I have to say that I find "revs/N/12345 where N = 12345/constant" to be most
> human unfriendly, where N isn't an actual power of 10.  I can't divide large
> numbers by 4000 in my head, but I could if it were 1000.  I'm also concerned
> about the performance characteristics of NTFS (in particular) which seems to
> degrade much more quickly (to the point where I find it hard to even get a
> directory of the parent folder when a child folder has thousands of entries).

I actually did this for NTFS (under VMware) using a python script.  I 
posted my results earlier in this thread:
   http://svn.haxx.se/dev/archive-2007-03/0134.shtml

FWIW, NTFS scales very badly.  Reiser and HFS+ required several orders 
of magnitude more entries to reach a similar wait time.  So, while I 
hate to say it, NTFS and FAT should probably the file systems that guide 
most of this decision.

-John

PS  The ThreadFind link wasn't able to find any of the message ids I put 
in... is it actually updating?

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

Re: Sharded FSFS repositories - summary

Posted by Mark Phippard <ma...@gmail.com>.
On 3/13/07, John Peacock <jp...@rowman.com> wrote:
>
> Malcolm Rowe wrote:
> > - We'll create shards of 4000 entries each.  That's large enough that
> >   someone would have to hit 16M revisions before a larger value would be
> >   an improvement, but small enough that it has reasonable performance
> >   (and support) on all filesystems that I'm aware of.  It's also a
> >   power-of-ten, so easier for humans to understand.
>
> I have to say that I find "revs/N/12345 where N = 12345/constant" to be
> most
> human unfriendly, where N isn't an actual power of 10.  I can't divide
> large
> numbers by 4000 in my head, but I could if it were 1000.  I'm also
> concerned
> about the performance characteristics of NTFS (in particular) which seems
> to
> degrade much more quickly (to the point where I find it hard to even get a
> directory of the parent folder when a child folder has thousands of
> entries).
>
> I suggest that we write a quick script to generate a variety of sharding
> schemes
> and test it on multiple filesystems, rather than just picking something
> out of
> thin air.  It may be that a multilevel system that is closer to a hashing
> algorithm will be superior to any arbitrary [fixed] division.


I think that some kind of multi-level system would be best.  Either
something like a new top level folder every 10,000 revisions, with
sub-folders grouping every 1,000 revisions, or maybe even a top level folder
every 100,000 revisions, with a sub folder every 10,000 revisions with
additional sub-folders every 1,000 revisions.  This latter option might be
over optimizing a bit for really large repositories, so I would probably go
with a folder every 10,000 revisions, and then inside those folders, break
it down by every 1,000 revisions.

-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/

Re: Sharded FSFS repositories - summary

Posted by John Peacock <jp...@rowman.com>.
Peter Lundblad wrote:
> Just to make sure, when talking about NTFS, are you talking about the
> performance of viewing the files in explorer or did you do tests on a lower
> level?

Both, though obviously performance with Explorer is much worse.  My primary
experience with NTFS and lots of small files is a shopping cart application.
What I haven't tested is sequential vs random access of predetermined filenames.
   That's why I'd really rather write a utility that timed various scenarios on
different filesystems so we can get a good handle on how Subversion itself is
likely to behave.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

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

Re: Sharded FSFS repositories - summary

Posted by Peter Lundblad <pl...@google.com>.
John Peacock writes:
> about the performance characteristics of NTFS (in particular) which seems to
> degrade much more quickly (to the point where I find it hard to even get a
> directory of the parent folder when a child folder has thousands of entries).
> 

Just to make sure, when talking about NTFS, are you talking about the
performance of viewing the files in explorer or did you do tests on a lower
level?  Also, note that FSFS does *not* rely on the capability to list
files, just to access them underneath the directory.

Thanks,
//Peter

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

Re: Sharded FSFS repositories - summary

Posted by John Peacock <jp...@rowman.com>.
Malcolm Rowe wrote:
> - We'll create shards of 4000 entries each.  That's large enough that
>   someone would have to hit 16M revisions before a larger value would be
>   an improvement, but small enough that it has reasonable performance
>   (and support) on all filesystems that I'm aware of.  It's also a
>   power-of-ten, so easier for humans to understand.

I have to say that I find "revs/N/12345 where N = 12345/constant" to be most
human unfriendly, where N isn't an actual power of 10.  I can't divide large
numbers by 4000 in my head, but I could if it were 1000.  I'm also concerned
about the performance characteristics of NTFS (in particular) which seems to
degrade much more quickly (to the point where I find it hard to even get a
directory of the parent folder when a child folder has thousands of entries).

I suggest that we write a quick script to generate a variety of sharding schemes
and test it on multiple filesystems, rather than just picking something out of
thin air.  It may be that a multilevel system that is closer to a hashing
algorithm will be superior to any arbitrary [fixed] division.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Blvd
Suite H
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

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