[prev in list] [next in list] [prev in thread] [next in thread] 

List:       reiserfs-devel
Subject:    (reiserfs) Reiserfs faster on fsync benchmarked some more
From:       Hans Reiser <reiser () idiom ! com>
Date:       1999-02-23 18:56:54
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I suggest you try writing the file, flushing the cache by cating /dev/hda, then \
dirtying 1% of the file and fsync'ing. This would resemble what happens with a file \
that is large and has been around for a while.

Best,

Hans

--
Don't be locked out of the source, and doomed to life in the slow lane.
Dump NT! Get Linux (http://www.kernel.org) plus ReiserFS
 (http://devlinux.org/namesys).  If you sell an OS or
internet appliance, buy a port of ReiserFS!
Speed matters.  Trees are fast.  Go faster!


[Attachment #5 (text/html)]

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I suggest you try writing the file, flushing the cache by cating /dev/hda,
then dirtying 1% of the file and fsync'ing.
<br>This would resemble what happens with a file that is large and has
been around for a while.
<p>Best,
<p>Hans
<pre>--&nbsp;
Don't be locked out of the source, and doomed to life in the slow lane.
Dump NT! Get Linux (<A HREF="http://www.kernel.org">http://www.kernel.org</A>) plus ReiserFS
&nbsp;(<A HREF="http://devlinux.org/namesys">http://devlinux.org/namesys</A>).&nbsp; If you sell an OS or
internet appliance, buy a port of ReiserFS!
Speed matters.&nbsp; Trees are fast.&nbsp; Go faster!</pre>
&nbsp;</html>

[Attachment #6 (message/rfc822)]



Hans Reiser wrote:

> What about when you write the 500mb file, flush the cache, modify
> (dirty) a few of its blocks (e.g. the last one), and then fsync?

Here are the results of new benchmark:  fsync time  for  the 500MB file
when a part of the file buffers are dirty buffers.

3Mb of dirty buffers:   0.6 %  of the file size
reiserfs fsync time  (in sec): 1
ext2fs   fsync time  (in sec): 1

6Mb of dirty buffers:  1.2%  of the file size
reiserfs fsync time  (in sec): 1
ext2fs   fsync time  (in sec): 1

15Mb of dirty buffers:  3% of the file size
reiserfs fsync time  (in sec): 2
ext2fs   fsync time  (in sec): 16

60Mb of dirty buffers:  12% of the file size
reiserfs fsync time  (in sec): 2
ext2fs   fsync time  (in sec): 16

I changed fsync.c so that it can do lseek() and write() before fsync().
The program writes  N * 1024 of 1KB buffers in the beginnig , in the
middle and  in the end  of the file (500MB).

fsync.c
int main(int argc, char** argv)
{
  int fd, i, N;
  long time_before_fsync;
  char buf[1024];
  int file_size = 500 * 1024 * 1024;

  if (argc < 2 ) {prinf("Usage: fsync  <name_of_file>
<nr_buffers_to_dirty>"); return 0;}
  sscanf(argv[2],"%i",&N);
  N =  N *1024;

  fd = open (argv[1], O_RDWR, 0777);
  for(i=0;  i<N;  i++) { lseek(fd, i*1024, SEEK_SET); write(fd, buf,
sizeof(buf));  }
  for(i=0;  i<N;  i++) { lseek(fd, file_size / 2+ i*1024, SEEK_SET);
write(fd, buf, sizeof(buf)); }
  for(i=0;  i<N;  i++) { lseek(fd, file_size-i*1024, SEEK_SET);
write(fd, buf, sizeof(buf)); }

  time_before_fsync=time(NULL));
  fsync(fd);
  printf("fsync time (in sec): %u\n",(time(NULL)-time_bfore_fsync) );

  close(fd);
}


best,
Yura.

>
>
> "Yury Y.Rupasov" wrote:
>
>> Hans Reiser wrote:
>>
>> > This is not what I meant.  I meant what is the time to use the
>> > system call fsync on a 500mb file when a few of its blocks are
>> > dirty.
>> > This affects database performance, syslog performance, etc.
>>
>> Here is the fsync time of 500mb file when any file parts are out of
>> cache.
>>
>> reiserfs    1.768 seconds
>> ext2        15.625 seconds
>> ext2fs_fsync_time  /  reiserfs_fsync_time = 8.838
>>
>> Fsync time are almost the same for both file systems when file has
>> been accessed recently.
>> So, for the case, when there are only few dirty blocks of file the
>> results will be between these points.
>>
>> I wrote the program fsync,  did mkreiserfs, mount, make_file f500
>> (size=500MB), then  :
>>
>> $cat  /dev/hda5 >/dev/null
>> $time fsync /testfs/f500
>>
>> Then I did the same for ext2fs.
>>
>> Without  "cat  /dev/hda5  >/dev/null "  reiserfs and ext2fs do
>> fsync  < 1 second (reiserfs=0.273, ext2fs=0.554).
>>
>> fsync.c
>> int main(int argc, char** argv)
>> {
>>   int fd;
>>   fd = open (argv[1], O_RDWR, 0777);
>>
>>   printf("time_before_fsync: %u\n",time(NULL));
>>   fsync(fd);
>>   printf("time_after_fsync: %u\n",time(NULL));
>>
>>   close(fd);
>> }
>>
>> best,
>> Yura.
>>
>> >
>> >
>> >>  Hello, Hans
>> >>
>> >>  See attached files for test source.
>> >>
>> >>  reiserfs create 500mb file
>> >>  real 159.42
>> >>  user 19.08
>> >>  sys 59.83
>> >>
>> >>  reiserfs remove 500mb file
>> >>  real 0.78
>> >>  user 0.03
>> >>  sys 0.35
>> >>
>> >>  ext2fs create 500mb file
>> >>  real 161.10
>> >>  user 29.46
>> >>  sys 71.53
>> >>
>> >>  ext2fs remove 500mb file
>> >>  real 2.30
>> >>  user 0.04
>> >>  sys 0.61
>> >>
>> >>  best,
>> >>  Yura.
>> >>
>> >>  Hans Reiser wrote:
>> >>
>> >> > Yura, would you measure our performance when doing fsync on a
>> >> > 500mb file, and compare it to ext2?
>> >> > fsync performance is a current linux kernel thread....
>> >> > I have no idea what it is for reiserfs....
>> >> >
>> >> > Thanks,
>> >> >
>> >> > Hans
>> >> >
>> >> > "Manuel J. Galan" wrote:
>> >> >
>> >> >>  What happened with ReiserFS ?
>> >> >>
>> >> >>  -
>> >> >>  To unsubscribe from this list: send the line "unsubscribe
>> >> >>  linux-kernel" in
>> >> >>  the body of a message to majordomo@vger.rutgers.edu
>> >> >>  Please read the FAQ at http://www.tux.org/lkml/
>> >> >
>> >> > Hans
>> >> >
>> >> > --
>> >> > Don't be locked out of the source, and doomed to life in the slow lane.
>> >> > Dump NT! Get Linux (http://www.kernel.org) plus ReiserFS
>> >> >  (http://devlinux.org/namesys).  If you sell an OS or
>> >> > internet appliance, buy a port of ReiserFS!
>> >> > Speed matters.  Trees are fast.  Go faster!
>> >> >
>> >> >
>> >>
>> >>     -----------------------------------------------------------
>> >>  #!/bin/bash
>> >>
>> >>  if [ $# -lt 1 ]
>> >>  then
>> >>         echo Usage: sync_test log_file_name
>> >>         exit
>> >>  fi
>> >>
>> >>  LOGFILE=$1
>> >>
>> >>  umount /testfs
>> >>  mkreiserfs /dev/hda5
>> >>  mount -t reiserfs /dev/hda5 /testfs
>> >>
>> >>  echo "reiserfs create 500mb file">> $LOGFILE
>> >>  (time -p create_file )>> $LOGFILE 2>&1
>> >>
>> >>  echo "reiserfs remove 500mb file">> $LOGFILE
>> >>  (time -p remove_file )>> $LOGFILE 2>&1
>> >>
>> >>  sleep 30
>> >>  umount /testfs
>> >>  mke2fs /dev/hda5
>> >>  mount -t ext2 /dev/hda5 /testfs
>> >>
>> >>  echo "ext2fs create 500mb file">> $LOGFILE
>> >>  (time -p create_file )>> $LOGFILE 2>&1
>> >>
>> >>  echo "ext2fs remove 500mb file">> $LOGFILE
>> >>  (time -p remove_file )>> $LOGFILE 2>&1
>> >>
>> >>     -----------------------------------------------------------
>> >>  #!/bin/bash
>> >>  mkfile /testfs/f500mb 524288000 1048576
>> >>  sync
>> >>
>> >>     -----------------------------------------------------------
>> >>  #!/bin/bash
>> >>  rm /testfs/f500mb
>> >>  sync
>> >>
>> > --
>> > Don't be locked out of the source, and doomed to life in the slow lane.
>> > Dump NT! Get Linux (http://www.kernel.org) plus ReiserFS
>> >  (http://devlinux.org/namesys).  If you sell an OS or
>> > internet appliance, buy a port of ReiserFS!
>> > Speed matters.  Trees are fast.  Go faster!
>> >
>> >
>>
> --
> Don't be locked out of the source, and doomed to life in the slow lane.
> Dump NT! Get Linux (http://www.kernel.org) plus ReiserFS
>  (http://devlinux.org/namesys).  If you sell an OS or
> internet appliance, buy a port of ReiserFS!
> Speed matters.  Trees are fast.  Go faster!
>
>

[Attachment #9 (text/html)]

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hans Reiser wrote:
<blockquote TYPE=CITE>What about when you write the 500mb file, flush the
cache, modify (dirty) a few of its blocks (e.g. the last one), and then
fsync?</blockquote>
Here are the results of new benchmark:&nbsp; fsync time&nbsp; for&nbsp;
the 500MB file when a part of the file buffers are dirty buffers.
<br>&nbsp;
<br>3Mb of dirty buffers:&nbsp;&nbsp; 0.6 %&nbsp; of the file size
<br>reiserfs fsync time&nbsp; (in sec): 1
<br>ext2fs&nbsp;&nbsp; fsync time&nbsp; (in sec): 1
<p>6Mb of dirty buffers:&nbsp; 1.2%&nbsp; of the file size
<br>reiserfs fsync time&nbsp; (in sec): 1
<br>ext2fs&nbsp;&nbsp; fsync time&nbsp; (in sec): 1
<p>15Mb of dirty buffers:&nbsp; 3% of the file size
<br>reiserfs fsync time&nbsp; (in sec): 2
<br>ext2fs&nbsp;&nbsp; fsync time&nbsp; (in sec): 16
<p>60Mb of dirty buffers:&nbsp; 12% of the file size
<br>reiserfs fsync time&nbsp; (in sec): 2
<br>ext2fs&nbsp;&nbsp; fsync time&nbsp; (in sec): 16
<p>I changed fsync.c so that it can do lseek() and write() before fsync().
<br>The program writes&nbsp; N * 1024 of 1KB buffers in the beginnig ,
in the middle and&nbsp; in the end&nbsp; of the file (500MB).
<p>fsync.c
<br>int main(int argc, char** argv)
<br>{
<br>&nbsp; int fd, i, N;
<br>&nbsp; long time_before_fsync;
<br>&nbsp; char buf[1024];
<br>&nbsp; int file_size = 500 * 1024 * 1024;
<br>&nbsp;
<br>&nbsp; if (argc &lt; 2 ) {prinf("Usage: fsync&nbsp; &lt;name_of_file>&nbsp;
&lt;nr_buffers_to_dirty>"); return 0;}
<br>&nbsp; sscanf(argv[2],"%i",&amp;N);
<br>&nbsp; N =&nbsp; N *1024;
<br>&nbsp;
<br>&nbsp; fd = open (argv[1], O_RDWR, 0777);
<br>&nbsp; for(i=0;&nbsp; i&lt;N;&nbsp; i++) { lseek(fd, i*1024, SEEK_SET);
write(fd, buf, sizeof(buf));&nbsp; }
<br>&nbsp; for(i=0;&nbsp; i&lt;N;&nbsp; i++) { lseek(fd, file_size / 2+
i*1024, SEEK_SET); write(fd, buf, sizeof(buf)); }
<br>&nbsp; for(i=0;&nbsp; i&lt;N;&nbsp; i++) { lseek(fd, file_size-i*1024,
SEEK_SET); write(fd, buf, sizeof(buf)); }
<br>&nbsp;
<br>&nbsp; time_before_fsync=time(NULL));
<br>&nbsp; fsync(fd);
<br>&nbsp; printf("fsync time (in sec): %u\n",(time(NULL)-time_bfore_fsync)
);
<br>&nbsp;
<br>&nbsp; close(fd);
<br>}
<br>&nbsp;
<p>best,
<br>Yura.
<blockquote TYPE=CITE>&nbsp;
<p>"Yury Y.Rupasov" wrote:
<blockquote TYPE=CITE>Hans Reiser wrote:
<blockquote TYPE=CITE>This is not what I meant.&nbsp; I meant what is the
time to use the system call fsync on a 500mb file when a few of its blocks
are dirty.
<br>This affects database performance, syslog performance, etc.</blockquote>
Here is the fsync time of 500mb file when any file parts are out of cache.
<p>reiserfs&nbsp;&nbsp;&nbsp; 1.768 seconds
<br>ext2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15.625 seconds
<br>ext2fs_fsync_time&nbsp; /&nbsp; reiserfs_fsync_time = 8.838
<p>Fsync time are almost the same for both file systems when file has been
accessed recently.
<br>So, for the case, when there are only few dirty blocks of file the
results will be between these points.
<p>I wrote the program fsync,&nbsp; did mkreiserfs, mount, make_file f500
(size=500MB), then&nbsp; :
<p>$cat&nbsp; /dev/hda5 >/dev/null
<br>$time fsync /testfs/f500
<p>Then I did the same for ext2fs.
<p>Without&nbsp; "cat&nbsp; /dev/hda5&nbsp; >/dev/null "&nbsp; reiserfs
and ext2fs do fsync&nbsp; &lt; 1 second (reiserfs=0.273, ext2fs=0.554).
<p>fsync.c
<br>int main(int argc, char** argv)
<br>{
<br>&nbsp; int fd;
<br>&nbsp; fd = open (argv[1], O_RDWR, 0777);
<p>&nbsp; printf("time_before_fsync: %u\n",time(NULL));
<br>&nbsp; fsync(fd);
<br>&nbsp; printf("time_after_fsync: %u\n",time(NULL));
<p>&nbsp; close(fd);
<br>}
<p>best,
<br>Yura.
<blockquote TYPE=CITE>&nbsp;
<blockquote TYPE=CITE>Hello, Hans
<p>See attached files for test source.
<p>reiserfs create 500mb file
<br>real 159.42
<br>user 19.08
<br>sys 59.83
<p>reiserfs remove 500mb file
<br>real 0.78
<br>user 0.03
<br>sys 0.35
<p>ext2fs create 500mb file
<br>real 161.10
<br>user 29.46
<br>sys 71.53
<p>ext2fs remove 500mb file
<br>real 2.30
<br>user 0.04
<br>sys 0.61
<p>best,
<br>Yura.
<p>Hans Reiser wrote:
<blockquote TYPE=CITE>Yura, would you measure our performance when doing
fsync on a 500mb file, and compare it to ext2?
<br>fsync performance is a current linux kernel thread....
<br>I have no idea what it is for reiserfs....
<p>Thanks,
<p>Hans
<p>"Manuel J. Galan" wrote:
<blockquote TYPE=CITE>What happened with ReiserFS ?
<p>-
<br>To unsubscribe from this list: send the line "unsubscribe linux-kernel"
in
<br>the body of a message to majordomo@vger.rutgers.edu
<br>Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a></blockquote>
Hans
<pre>--&nbsp;
Don't be locked out of the source, and doomed to life in the slow lane.
Dump NT! Get Linux (<a href="http://www.kernel.org">http://www.kernel.org</a>) plus ReiserFS
&nbsp;(<a href="http://devlinux.org/namesys">http://devlinux.org/namesys</a>).&nbsp; If you sell an OS or
internet appliance, buy a port of ReiserFS!
Speed matters.&nbsp; Trees are fast.&nbsp; Go faster!</pre>
&nbsp;</blockquote>

<pre>
<hr WIDTH="90%" SIZE=4>#!/bin/bash

if [ $# -lt 1 ]
then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo Usage: sync_test log_file_name&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit
fi

LOGFILE=$1

umount /testfs
mkreiserfs /dev/hda5
mount -t reiserfs /dev/hda5 /testfs

echo "reiserfs create 500mb file">> $LOGFILE
(time -p create_file )>> $LOGFILE 2>&amp;1

echo "reiserfs remove 500mb file">> $LOGFILE
(time -p remove_file )>> $LOGFILE 2>&amp;1

sleep 30
umount /testfs
mke2fs /dev/hda5
mount -t ext2 /dev/hda5 /testfs

echo "ext2fs create 500mb file">> $LOGFILE
(time -p create_file )>> $LOGFILE 2>&amp;1

echo "ext2fs remove 500mb file">> $LOGFILE
(time -p remove_file )>> $LOGFILE 2>&amp;1</pre>

<pre>
<hr WIDTH="90%" SIZE=4>#!/bin/bash
mkfile /testfs/f500mb 524288000 1048576
sync</pre>

<pre>
<hr WIDTH="90%" SIZE=4>#!/bin/bash
rm /testfs/f500mb&nbsp;
sync</pre>
</blockquote>

<pre>--&nbsp;
Don't be locked out of the source, and doomed to life in the slow lane.
Dump NT! Get Linux (<a href="http://www.kernel.org">http://www.kernel.org</a>) plus ReiserFS
&nbsp;(<a href="http://devlinux.org/namesys">http://devlinux.org/namesys</a>).&nbsp; If you sell an OS or
internet appliance, buy a port of ReiserFS!
Speed matters.&nbsp; Trees are fast.&nbsp; Go faster!</pre>
&nbsp;</blockquote>
</blockquote>

<pre>--&nbsp;
Don't be locked out of the source, and doomed to life in the slow lane.
Dump NT! Get Linux (<a href="http://www.kernel.org">http://www.kernel.org</a>) plus ReiserFS
&nbsp;(<a href="http://devlinux.org/namesys">http://devlinux.org/namesys</a>).&nbsp; If you sell an OS or
internet appliance, buy a port of ReiserFS!
Speed matters.&nbsp; Trees are fast.&nbsp; Go faster!</pre>
&nbsp;</blockquote>
</html>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic