EXT2 vs. EXT3: mount w/sync or fdatasync

brian stone skye0507 at yahoo.com
Fri Mar 23 03:44:40 UTC 2007

Ran some performance tests as suggested.

Machine A connects to machine B on a gigabit lan.  Machine A sends 
1024 1MB chucks of data; 1 GB in total. Machine B, the server, reads 
in the MB and writes it to a file.

NOTE: server and client are little test programs written in C.  

Machine B (Server) hardware:
- Single (no raid) Seagate Cheetah 70G Ultra320 15K
- Quad Opteron 870
- 16G DDR400
- Backplane: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 8)

Sync methods include:
1. mount with sync option
  - tried sync,dirsync which added no additional overhead
2. use O_SYNC open() flag
3. use fdatasync() just before closing the file
  - fsync() and fdatasync() produced the same results

EXT2 tests
No sync                     12.3 seconds  (83 MB/Sec)
mount=sync                  44.3 seconds  (23 MB/Sec)
O_SYNC                      31.7 seconds  (32 MB/Sec)
fdatasync()                 31.3 seconds  (32 MB/Sec)

EXT3 tests
No sync data=writeback      14.5 seconds  (70 MB/Sec)
No sync data=ordered        17 seconds    (60 MB/Sec)
No sync data=journal        65 seconds    (15 MB/Sec)
data=ordered O_SYNC         49 seconds    (20 MB/Sec)
data=ordered,sync           52 seconds    (19 MB/Sec)
data=ordered fdatasync()    45.5 seconds  (22 MB/Sec)
data=journal O_SYNC         72.5 seconds  (14 MB/Sec)
data=journal,sync           81 seconds    (12 MB/Sec)
data=journal fdatasync()    60.5 seconds  (17 MB/Sec)


Andreas Dilger <adilger at clusterfs.com> wrote: On Mar 21, 2007  16:51 -0700, brian stone wrote:
> My application always needs to sync file data after writing. I don't want anything handing around in the kernel buffers. I am wondering what is the best method to accomplish this.

>  4. Do I use EXT3 in full journaled mode, where the data and metadata are journaled? In this case, is the journaled data sync'd or async'd? When the journal commits the data to the file system, is that sync'd or dumped into kernel buffers?
>  5. Since I will always be syncing the data, does it make any sense to use EXT3? It feels like the EXT3 journal would be unnecessary.

In theory, ext3 + data=journal will give you the best performance, because
sync IO will always be linear IO to the journal.  Unless your filesystem is
constantly busy, then the writes to the filesystem can happen asynchronously
after being committed to the journal without danger of being lost.

That said, nothing better than benchmarking your app with different
filesystem options to see which one is best.

Cheers, Andreas
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20070322/e1811773/attachment.htm>

More information about the Ext3-users mailing list