Solved disappointing performance of gstripe vs mdadm

At the risk of triggering a few zealots, I have been profiling throughput on a dual boot machine (debian 12 and BSD 15) where I created a 4KB chunk size RAID0 volume of 200GB that is accessible from both BSD and Linux (two disk volume). The volume is non-persistent so I create it at boot time on each OS. Anyways, the filesystem is ext2 and I've loaded it up with 181 files totaling 26.8GB in size.

I'm hoping someone can adequately explain the difference in performance between Linux and BSD. Raw sequential volume reads are about 180MB/sec in Linux and 60MB/sec in BSD (measured by timing dd raw device reads). Sequential filesystem reads are 150MB/sec in Linux and 50MB/sec in BSD (measured by cumulatively catt-ing files to /dev/null before they have been cached by the FS cache). I have not profiled write times. But...the 3times better performance in Linux is something that cannot be ignored. Any unbiased technical explanations of why the difference?

And no, I don't want to have a discussion about ZFS. I need a least common denominator shared drive between Linux and BSD in dual boot so RAID0/ext2 fits the bill.
 
I found that gmirror was really slow. Ok it is a mirror and the disks are SATA1 but it was slow.
I found that just by -a aligning the sectors for gpart add on the first partition it sped up by double.
Granted this is super small medium of paired 16GB Innodisk SSD.
Code:
gpart add -t efi -a4k -s 200M /dev/mirror/gm0
gpart add -t freebsd-ufs /dev/mirror/gm0


I use diskinfo. I don't know how accurate it is with cache but it is a standard for me.
Inner sectors and Outer sectors are so quaint. But its my built-in speedometer.
 
Benchmarking storage is hard, as Cracauer said above. But given that you are probably doing the same thing (whether that is accurate or not) on two different OSes, the question remains.

The title of the thread says "gstripe vs mdadm" ... which one do you really use? I don't think they're compatible.

Why are you using RAID 0 in the first place? For 200 GB, a single drive should be perfectly sufficient. Matter-of-fact, the performance you're getting seems to indicate that exactly one drive is in use. Can you rerun the test without the RAID layer?

Final obnoxious comment: The file system you are using, ext2, is native and incredibly well tuned, optimized and debugged on Linux. On FreeBSD, it is a second class citizen. My attitude is always that I'm surprised anytime a non-native file system works at all; I would not expect it to work well. (The exception to that rule is FAT, which I expect to be implemented correctly on any operating system).
 
OP is recreating and reformatting the raid0 every time at boot, with striping and filesystem native to whatever OS cames up. As far as I understand.
 
gstripe was a huge disappointment for me.

 
OP is recreating and reformatting the raid0 every time at boot, with striping and filesystem native to whatever OS cames up. As far as I understand.
partially correct. Shared two disk stripes (identical disks and partition layouts), using gstripe in BSD and legacy mdadm "build" command in Linux, duplicating the layout exactly, and NO METADATA is saved on the disks. The unit is create by rc.local commands at startup.

Re dd vs fsync....given that I'm raw reading 10GB using 1M blocks and metering the time it takes (165sec in linux and 525sec in BSD) the effects of disk caching should be negligible. Of course someone latched onto the ext2 issue, which is largely irrelevant since the performance degradation is by an equal percentage on both linux and BSD. At the base level let's just concentrate on raw disk IO. The performance hit of introducing ext2 was reasonable and expected (and the mkfs.ext2 only had to be done once. Once it is on the volume it is platform agnostic since both OSs support it). The raw disk read performance of three times better throughput in Linux is what I'm interested in. And yes...given that I'm only creating a striped 2 disk RAID0 volume, as I'm using them gstripe and mdadm should be functionally equivalent.

raw test: time dd if=/dev/stripe/st0 of=/dev/null bs=1M count=10000 skip=20000
ext2 test: time (cd /work; for i in $(find . -type f | sort); do cat $i > /dev/null; done)

in BSD: gstripe -s 4096 st0 /dev/DISK-ID/disk1s1 /dev/DISK-ID/disk2s1
in Linux: mdadm --build /dev/md0 --level=0 --chunk-size=4096 /dev/disk-id/disk1s1 /dev/disk-id/disk2s1

am explicitly using the queried hardware name for each slice since both OS may inconsistently re-enumerate device names on reboot.
 
problem solved!

I downloaded and inspected the sourcecode for g_stripe and noted that there is a "fast mode" option that is disabled by default.

in /etc/sysctl.conf add -> kern.geom.stripe.fast=1

Now I'm getting raw block reads of better than 200MB/s throughput, and ext2fs reads of 127MB/sec. These are numbers on par with what I'd expect for a two disk RAID0 volume.

I also noted that if the driver is already loaded then changing the kernel parameter in realtime makes no difference. It lonly worked if I added it to /etc/sysctl.con so that the option was enabled before the module was loaded.
 
Back
Top