Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2012 15:46:26 +0200
From:      Maurizio Vairani <maurizio.vairani@cloverinformatica.it>
To:        Gleb Kurtsou <gleb.kurtsou@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: [RFC] tmpfs RB-Tree for directory entries
Message-ID:  <500EA732.1070401@cloverinformatica.it>
In-Reply-To: <20120621140149.GA59722@reks>
References:  <20120621140149.GA59722@reks>

next in thread | previous in thread | raw e-mail | index | archive | help
On 21/06/2012 16.01, Gleb Kurtsou wrote:
> Hello,
>
> Here is patch for CURRENT replacing directory entry linked list with
> RB-Tree in tmpfs. Performance improvement varies for different
> workloads, it may be negligible for directories with small number of
> files or due to VFS name caching.
>
> http://people.freebsd.org/~gleb/tmpfs-nrbtree.1.patch
>
> This patch is unrelated to similar changes recently committed to
> DragonFly:
> https://bugs.dragonflybsd.org/issues/2375
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/29ca4fd6da8bb70ae90d8e73ea3c47fda22491a7
>
> My patch uses name hashes instead of comparing entries by file name,
> moreover it reuses the same hash value as directory entry offset and
> eliminates possible issue of duplicate directory offsets on 64-bit
> archs. In other words it makes VOP_READDIR on large directories faster
> for non-zero offsets.
>
> I'm willing to commit the patch and would appreciate if people actively
> using tmpfs give it a try.
>
> Thanks,
> Gleb.
>
>
> ** file_create test from DragonFly PR
> % time ~/file_create 10000
>
> x tmpfs-file_create-rb
> + tmpfs-file_create-orig
> +------------------------------------------------------------------------+
> |                                                                  +     |
> |x                                                                 +     |
> |xx                                                                +     |
> |xx                                                                +    +|
> |A|                                                                      |
> |                                                                 |MA_|  |
> +------------------------------------------------------------------------+
>      N           Min           Max        Median           Avg        Stddev
> x   5         0.112          0.14         0.119        0.1234   0.012116105
> +   5         2.551         2.734         2.551        2.5886   0.081309901
> Difference at 95.0% confidence
> 	2.4652 +/- 0.0847787
> 	1997.73% +/- 68.7023%
> 	(Student's t, pooled s = 0.0581296)
>
>
> ** test1 -- create 5000 files, rename some of them, remove files
> time sh ~/test1.sh
>
> x tmpfs-test1-rb
> + tmpfs-test1-orig
> +------------------------------------------------------------------------+
> |  x x        x                      +                          +++      |
> ||___MA_____|                                                            |
> |                                           |_____________A______M______||
> +------------------------------------------------------------------------+
>      N           Min           Max        Median           Avg        Stddev
> x   4         5.893         6.091         5.932        5.9535   0.093289871
> +   4          6.49         7.006         6.987        6.8655    0.25058931
> Difference at 95.0% confidence
> 	0.912 +/- 0.327153
> 	15.3187% +/- 5.49514%
> 	(Student's t, pooled s = 0.189074)
>
>
> test1.sh:
> #!/bin/sh
> for i in `jot 5000`; do echo $i>  longername$i; done
> ls>/dev/null
> for i in `jot 899 100`; do mv longername$i longername1$i; done
> ls>/dev/null
> for i in `jot 899 100`; do mv longername2$i longername3$i; done
> ls>/dev/null
> for i in `jot 5000`; do rm longername$i 2>/dev/null; done
>
> _______________________________________________
> freebsd-fs@freebsd.org  mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to"freebsd-fs-unsubscribe@freebsd.org"

I applied patch on my test machines on 9-STABLE with 4G RAM and 2G of swap space :
# uname -a
FreeBSD clover-nas-test 9.0-STABLE FreeBSD 9.0-STABLE #2: Tue Jul 10 17:45:25 CEST 2012     ssh@clover-nas-test:/usr/obj/usr/src/sys/GENERIC  amd64
# swapinfo -h
Device          1K-blocks     Used    Avail Capacity
/dev/zvol/poolusb/swap   2097152     3.5M       2G     0%

tmpfs is used for :
# df -h | grep tmpfs
tmpfs                                                 2.2G    1.1M    2.2G     0%    /tmp
tmpfs                                                 2.2G    4.0k    2.2G     0%    /var/tmp
tmpfs                                                 2.2G    188k    2.2G     0%    /var/log
tmpfs                                                 2.2G    120k    2.2G     0%    /var/run
tmpfs                                                 2.2G     36k    2.2G     0%    /var/db/entropy
tmpfs                                                 2.2G    512k    2.2G     0%    /var/db/samba
tmpfs                                                 2.2G     32k    2.2G     0%    /var/spool

No regression for three days even low memory condition.
# dmesg | grep swap
pid 58480 (ssh), uid 0, was killed: out of swap space






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?500EA732.1070401>