Improving ZFS performance for large directories

Bob Friesenhahn bfriesen at simple.dallas.tx.us
Fri Feb 22 02:47:26 UTC 2013


On Tue, 19 Feb 2013, Kevin Day wrote:

> Sorry for the late followup, I've been doing some testing with an L2ARC device.
>
>>> Doing it twice back-to-back makes a bit of difference but it's still slow either way.
>>
>> ZFS can very conservative about caching data and twice might not be enough.
>> I suggest you try 8-10 times, or until the time stops reducing.
>
> Timing doing an "ls" in large directories 20 times, the first is the slowest, then all subsequent listings are roughly the same. There doesn't appear to be any gain after 20 repetitions

You might consider that the bottleneck might be in 'ls' or something
outside of zfs.  Make sure that you are doing 'ls -f' or else you are
just measuring its sorting performance.

On a Solaris 10 system in a zfs directory with a million files:

% time ls -f |wc -l
  1000002
/bin/ls -F -f  0.76s user 0.93s system 89% cpu 1.897 total
wc -l  0.08s user 0.02s system 5% cpu 1.697 total

% time ls |wc -l
  1000000
/bin/ls -F  4.32s user 8.10s system 97% cpu 12.682 total
wc -l  0.08s user 0.02s system 0% cpu 12.432 total

Bob
-- 
Bob Friesenhahn
bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


More information about the freebsd-fs mailing list