On Tue, Jan 06, 2004 at 05:55:24PM +0300, Hans Reiser wrote: > > htree has performance problems that are due to its architecture --- I > think this is why they don't make it on by default --- it actually slows > ext3 down substantially for average directory sizes..... you can see > that on our benchmarks page, or just by copying around some copies of > the linux kernel yourself with it on and off. Actually, the reason why we didn't enable by default was more because of conservatism; it's a new feature, and during the bug shakedown phase, we didn't want to impact users with some of the initial memory leaks, NFS server incompatibilities, etc., that have since been all fixed. Htree has performance problems for certain workloads --- specifically, workloads that do a readdir() followed by a stat(). This is because readdir() returns inodes in hash value order, instead of in the order that the files were created (which generally meant increasing inode order). Because accesses to the inode table now become random, this adversely impacts certain workloads, such as the kernel tar and untar benchmark. This can be easily fixed by changing the application to sort the inodes by inode number, or by using an LD_PRELOAD library to do the sorting in userspace. (See attached). Whether or not this performance issue is a problem in real life is a different story. If you are just doing accesses in random order and are doing lookups by name, such as in a squid cache, you won't see this issue at all, and htree will be a huge win. However, if like sendmail the program is running readdir() and then stat'ing all files, then the following LD_PRELOAD library is necessary to avoid a performance regression caused by htree returning files in hash order. (Note that this LD_PRELOAD library will often speed up readdir/stat workloads on non-htree filesystems as well, since in general most inode-based filesystems are happier when you access files in inode order, and over time, directories tend to get disordered and are no longer in create/inode number sorted order.) - Ted