Storing & accessing up to 10 million files in Linux

前端 未结 2 582
渐次进展
渐次进展 2021-01-31 16:46

I\'m writing an app that needs to store lots of files up to approx 10 million.

They are presently named with a UUID and are going to be around 4MB each but always the sa

2条回答
  •  一整个雨季
    2021-01-31 17:09

    You should definitely store the files in subdirectories.

    EXT4 and XFS both use efficient lookup methods for file names, but if you ever need to run tools over the directories such as ls or find you will be very glad to have the files in manageable chunks of 1,000 - 10,000 files.

    The inode number thing is to improve the sequential access performance of the EXT filesystems. The metadata is stored in inodes and if you access these inodes out of order then the metadata accesses are randomized. By reading your files in inode order you make the metadata access sequential too.

提交回复
热议问题