# SLOG mirror with a sparse file



## belon_cfy (Jul 17, 2012)

Hi
I'm adding a sparse file to my SLOG device for mirroring since there is only 1 SSD available on my current FreeBSD storage. Performance wise is close to the purely SSD based SLOG. What I'm concerning is will it able to prevent data loss due to my SLOG SSD death?

The storage consists of 2 zfs pool which are zroot and vol. The SLOG was added at the vol but the sparse file is sitting on the zroot with sync=disabled, atime=off, compression=on and recordsize=128k for better write performance.

I'm getting the following tps on ESXI virtual machine when SLOG device is not present:

```
Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
sda3             15.00         0.00         0.06          0          0
sda3            106.00         0.00         0.98          0          0
sda3            311.88         0.00         1.57          0          1
sda3            259.00         0.00         1.01          0          1
sda3            139.00         0.00         0.54          0          0
sda3             23.00         0.00         0.09          0          0
sda3            380.00         0.00         1.89          0          1
sda3            249.00         0.00         0.97          0          0
sda3             59.41         0.00         0.24          0          0
sda3              5.00         0.00         0.71          0          0
sda3            185.00         0.00         1.54          0          1
```

Below is the zpool status after adding the ssd and sparse file as a mirrored SLOGï¼š

```
NAME         STATE     READ WRITE CKSUM
        vol          ONLINE       0     0     0
          mirror-0   ONLINE       0     0     0
            ada0p3   ONLINE       0     0     0
            ada1p3   ONLINE       0     0     0
          mirror-1   ONLINE       0     0     0
            ada2p3   ONLINE       0     0     0
            ada3p3   ONLINE       0     0     0
        logs
          mirror-2   ONLINE       0     0     0
            md0.nop  ONLINE       0     0     0
            ada4p1   ONLINE       0     0     0
        cache
          ada4p2     ONLINE       0     0     0
```

Performance on during dd with 4k write, tps is much higher than before

```
Device:            tps    MB_read/s    MB_wrtn/s    MB_read    MB_wrtn
sda3           1361.00         0.01         5.68          0          5
sda3           1509.00         0.25         6.33          0          6
sda3           1151.49         0.02         5.09          0          5
sda3           1848.00         0.02         7.43          0          7
sda3           1099.00         0.65         4.23          0          4
sda3           1765.00         0.00         6.89          0          6
sda3           1714.00         0.00         6.77          0          6
sda3           1754.00         0.00         6.93          0          6
sda3           1873.00         0.00         7.88          0          7
sda3           1478.00         0.02         5.75          0          5
sda3           1806.00         0.00         7.49          0          7
sda3           1086.00         0.00         4.57          0          4
sda3           2024.75         0.00         7.91          0          7
```

I guess the data on slog will survive after power outage as long as the ssd is there, correct me if I'm wrong. 

Is adding a sparse file as slog mirror is necessary? Will zfs keep the data on SLOG in RAM automatically to prevent data loss when slog SSD sudden death?

Can we apply the same theory on ram disk pair with SSD instead of sparse file for mirroring?

Thanks.


----------

