3

I'm building a service where I'll need to store a ton of files on a filesystem. I've heard in the past that it's better to separate up files by folder when dealing with large amounts of files. Is this really accurate for modern Linux filesystems such as ext3, ext4, and btrfs? If so, how much should I divide up files? Should I keep 1000 files to a folder?

The current setup I have divides them up into hundreds, thousands, tens of thousands, and hundreds of thousands like so:

stream id: 123456
1/2/3/4/123456.file

stream id: 654321
6/5/4/3/654321.file

stream id: 5
0/0/0/0/5.file

Does this make sense for my application?

1
  • 1
    Just because they're all "modern", doesn't mean they all perform the same in all circumstances. Please be more specific in future.
    – womble
    Aug 12, 2011 at 1:15

1 Answer 1

5

You should also consider the amount folders you are creating.

In the related question the general rule seems to be up to 20k files per directory for performance reasons:
Maximum number of files in one ext3 directory while still getting acceptable performance?

1
  • I suppose I'll filter down to maybe a thousand or ten thousand per folder, as that seems to be a good median. Aug 12, 2011 at 1:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .