Metadata performance much worse than on parent filesystem

Bug #988628 reported by fa2k
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
eCryptfs
Won't Fix
Undecided
Unassigned

Bug Description

Listing directories and scanning files is very slow. When I use Unison (~like rsync) on the underlying filesystem, it is instantaneous to check for changes, but in the encrypted filesystem it can take minutes. Could eCryptfs please take advantage of the underlying filesystem's cache?

Revision history for this message
Tyler Hicks (tyhicks) wrote :

Hello - thanks for using eCryptfs!

Unfortunately, the performance issues associated with lookup(), stat(), and open() are unavoidable. eCryptfs currently leverages the lower filesystem's dentry, inode, and page cache appropriately. The problem stems from eCryptfs needing to read the first 16 bytes of the lower file during lookup() and stat() and needing to read and process the first 8192 bytes of the lower file during open(). This is due to the design of eCryptfs and is not avoidable.

If someone else can identify potential speedups in these areas of the code, I'd be more than happy to review/merge/implement their ideas but I've been unable to find any noticeable improvements that would be reasonable to implement.

Changed in ecryptfs:
status: New → Won't Fix
Revision history for this message
fa2k (pmb) wrote :

Thanks for the reply, that's very reasonable

Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

Just to quantify "much worse", ls -lR on ~/Pictures and the same folder on the parent filesystem (/home/.ecryptfs/jakob/.Private/ECRYPTFS_FNEK_.... - identified by folder size)

echo 3 > /proc/sys/vm/drop_caches
time ls -lR

parent: 9s
ecryptfs: 3m23s (takes 22 times longer!)

Revision history for this message
Tyler Hicks (tyhicks) wrote :

You may want to try `/bin/ls -lR`

I've noticed some distros alias ls to 'ls --color=auto'. That would cause a stat() call on each file, which would cause noticeable performance decreases when comparing eCryptfs to a native filesystem. This isn't a solution, but may be a usable workaround for some people.

Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

Hi Tyler, thanks for the response!

Actually, the "-l" will cause a stat() anyway, but regular ls should be faster that way!
I did ls -lR because that is what shotwell does on startup (library rescan).

Now, I acually have a suggestion for improving the stat() speed:
Cache the file size in an extended attribute to avoid the 16 byte read!

I have tested this on ext4, 7200rpm disk, and reading the first 16 bytes of 10000 files takes 5.175 seconds, while reading a 16 bytes extended attribute takes only 0.777 seconds.
In short, extended attributes seem to be 6.6 times faster.

Exact test commands are attached!

Revision history for this message
fa2k (pmb) wrote :

There is a mount option for using xattrs, but I can't test it because I don't know how to use it with the automatic mount on logon feature. Also, I don't know if this refers to the metadata jakobunt was requesting.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.