Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2006 19:49:41 +1100
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        alc@freebsd.org, Mikhail Teterin <mi+mx@aldan.algebra.com>, stable@freebsd.org
Subject:   Re: Reading via mmap stinks (Re: weird bugs with mmap-ing via NFS)
Message-ID:  <20060324084940.GA703@turion.vk2pj.dyndns.org>
In-Reply-To: <200603232316.k2NNGBka068754@apollo.backplane.com>
References:  <200603211607.30372.mi%2Bmx@aldan.algebra.com> <200603231403.36136.mi%2Bmx@aldan.algebra.com> <200603232048.k2NKm4QL067644@apollo.backplane.com> <200603231626.19102.mi%2Bmx@aldan.algebra.com> <200603232316.k2NNGBka068754@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2006-Mar-23 15:16:11 -0800, Matthew Dillon wrote:
>    FreeBSD.  To determine which of the two is more likely, you have to
>    run a smaller data set (like 600MB of data on a system with 1GB of ram),
>    and use the unmount/mount trick to clear the cache before each grep test.

On an amd64 system running about 6-week old -stable, both behave
pretty much identically.  In both cases, systat reports that the disk
is about 96% busy whilst loading the cache.  In the cache case, mmap
is significantly faster.

The test data is 2 copies of OOo_2.0.2rc2_src.tar.gz concatenated.

turion% ls -l /6_i386/var/tmp/test
-rw-r--r--  1 peter  wheel  586333684 Mar 24 19:24 /6_i386/var/tmp/test
turion% /usr/bin/time -l grep dfhfhdsfhjdsfl /6_i386/var/tmp/test
       21.69 real         0.16 user         0.68 sys
      1064  maximum resident set size
        82  average shared memory size
        95  average unshared data size
       138  average unshared stack size
       119  page reclaims
         0  page faults
         0  swaps
      4499  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
      4497  voluntary context switches
      3962  involuntary context switches

[umount/remount /6_i386/var]

turion% /usr/bin/time -l grep --mmap dfhfhdsfhjdsfl /6_i386/var/tmp/test
       21.68 real         0.41 user         0.51 sys
      1068  maximum resident set size
        80  average shared memory size
        93  average unshared data size
       136  average unshared stack size
     17836  page reclaims
     18081  page faults
         0  swaps
        23  block input operations
         0  block output operations
         0  messages sent
         0  messages received
         0  signals received
     18105  voluntary context switches
       169  involuntary context switches

The speed gain with mmap is clearly evident when the data is cached and
the CPU clock wound right down (99MHz ISO 2200MHz):

turion% /usr/bin/time grep --mmap dfhfhdsfhjdsfl /6_i386/var/tmp/test
       12.15 real         7.98 user         2.95 sys
turion% /usr/bin/time grep --mmap dfhfhdsfhjdsfl /6_i386/var/tmp/test
       12.28 real         7.92 user         2.94 sys
turion% /usr/bin/time grep --mmap dfhfhdsfhjdsfl /6_i386/var/tmp/test
       13.16 real         8.03 user         2.89 sys
turion% /usr/bin/time grep dfhfhdsfhjdsfl /6_i386/var/tmp/test 
       17.09 real         6.37 user         8.92 sys
turion% /usr/bin/time grep dfhfhdsfhjdsfl /6_i386/var/tmp/test
       17.36 real         6.35 user         9.37 sys
turion% /usr/bin/time grep dfhfhdsfhjdsfl /6_i386/var/tmp/test
       17.54 real         6.37 user         9.39 sys

-- 
Peter Jeremy



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