Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB mirror #18

Open
CurlyMoo opened this issue Jul 7, 2013 · 3 comments
Open

USB mirror #18

CurlyMoo opened this issue Jul 7, 2013 · 3 comments

Comments

@CurlyMoo
Copy link
Contributor

CurlyMoo commented Jul 7, 2013

I was wondering if it is possible to use a USB drive as mirror. My experience with ZFS is that you can easily add a device to a ZFS mirror. ZFS will than automatically use the fastest device and sync the other device in the background. This means in ZFS,

  1. that it will primarily use the fastest device
  2. balance the load of the devices, so when the fastest device is busy, it will use the second device in the mirror.
  3. real-time backups
  4. live replacing of a failed USB / SD device

I don't know a lot about BTRFS, so i don't now if the same things are possible with BTRFS.

@CurlyMoo
Copy link
Contributor Author

CurlyMoo commented Jul 8, 2013

I did some benchmarks and the results are as follows (SD card + USB stick):

                                                         random  random
           KB  reclen   write rewrite    read    reread    read   write
RAID1 : 51200       4     493     518     4578     4346    4440     649
RAID0 : 
- USB : 51200       4     730    1092     3788     2979    3691     281
- SD  : 51200       4     992     788     5558     4706    4974     732

             -33%    -35%     +20%     +50%    +20%   +130%

RAID1 : 51200     512    3748    4475    18705    11533   18672    4521
RAID0 : 
- USB : 51200     512    3157    3488    23652    17815   24158    2918
- SD  : 51200     512    4849    4182    17513    17537   17443    4198
                         +20%    +28%      +6%    -35%      +7%    +55%

RAID1 : 51200   16384    5572    5456    25016    24991   24994    3247
RAID0 :
- USB : 51200   16384    4151    4492    27078    27682   27621    3114
- SD  : 51200   16384    7632    9915    22041    22032   22050    9801
                         +31%    +21%     +13%     +13%    +13%     +4%

The percentages were calculated like this:
Increase: How much faster than the slowest of the USB/SD
Decrease: How much slower than the slowest of the USB/SD

Conclusion:

  • 4k write performance dropped by about 33%
  • 4k read performance has increased for about 33%*
  • All other IO show an increase of a about 20%*, except for the 512k reread.

*With the slowest device as the reference

I used a fairly slow and generic USB stick. However, the results show that the performance of the USB stick can be increased fairly well by a fast SD card. The ideal solution would of course be, adding a USB stick that is faster than the SD card so we get a overall performance gain instead of decrease.

The only problem is that you can't simply go back to the RAID0 situation. If you want to remove the USB drive from the mirror, you need to boot degraded mode.

@mk01
Copy link
Member

mk01 commented Jul 14, 2013

not sure about creating raid1 from single disk after it was created. needs to be tested. what I remember is, that raid1 conf was needed from time of creating the fs, with "dummy" - not existing - device. then, it was possible to add the mirror later.

but there are more options to investigate: move /home to another device (so dbs, thumbs, add ons & data) will unload system device.

or using other device as cache device (similar to ZFS L2ARC), which is now build in linux kernel, not dependent on fstype.

if only would RPI have at least two cores :))

@CurlyMoo
Copy link
Contributor Author

CurlyMoo commented Feb 8, 2015

if only would RPI have at least two cores :))

Is now has four :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants