# Testing ZFS dedup on an SSD pool



## t1066 (May 22, 2014)

I got this new Sandisk X210 512gb. And from what I glimpsed from the Internet, I decided to test enabling dedup on a zpool with an SSD.
The testing was as follows:

First I created the pool. Then I set atime=off, compression=lz4, checksum=sha256 and dedup=on.
I just used `zfs send` and `zfs recv` to populate the new pool with data. The result that I got from `zpool iostat -v` was as follows:

With already some 48.1G of data on the pool.


```
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2               48.1G   396G    911  1.77K  3.56M   217M
  gpt/x210-140785400341  48.1G   396G    911  1.77K  3.56M   217M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2               51.5G   393G  1.15K  1.65K  4.59M   203M
  gpt/x210-140785400341  51.5G   393G  1.15K  1.65K  4.59M   203M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2               54.8G   389G  1.18K  1.60K  4.74M   197M
  gpt/x210-140785400341  54.8G   389G  1.18K  1.60K  4.74M   197M
-----------------------  -----  -----  -----  -----  -----  -----
```

With the pool was almost three quarter full.


```
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                289G   155G  1.51K  1.33K  6.05M   165M
  gpt/x210-140785400341   289G   155G  1.51K  1.33K  6.05M   165M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                293G   151G  1.47K  1.37K  5.88M   165M
  gpt/x210-140785400341   293G   151G  1.47K  1.37K  5.88M   165M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                295G   149G  1.41K  1.28K  5.64M   157M
  gpt/x210-140785400341   295G   149G  1.41K  1.28K  5.64M   157M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                298G   146G  1.42K  1.37K  5.68M   169M
  gpt/x210-140785400341   298G   146G  1.42K  1.37K  5.68M   169M
-----------------------  -----  -----  -----  -----  -----  -----
```

After the above test was done, I revert some settings, checksum=fletcher4 and dedup=off. Then I populated the pool with some new data:


```
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                300G   144G      4  1.09K  18.2K   126M
  gpt/x210-140785400341   300G   144G      4  1.09K  18.2K   126M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                307G   137G      6  3.30K  24.2K   368M
  gpt/x210-140785400341   307G   137G      6  3.30K  24.2K   368M
-----------------------  -----  -----  -----  -----  -----  -----

                            capacity     operations    bandwidth
pool                     alloc   free   read  write   read  write
-----------------------  -----  -----  -----  -----  -----  -----
x210-test2                315G   129G      3  3.43K  15.0K   371M
  gpt/x210-140785400341   315G   129G      3  3.43K  15.0K   371M
-----------------------  -----  -----  -----  -----  -----  -----
```

I also used `gstat` to monitor the SSD. When dedup was running, I observed that there were times when the mean service time would surge past 10 ms and in the mean time, the SSD was always 95%+ busy.
From the above data, I observed that when dedup was running, there were approximately 1000 of 4KB reads from the SSD and 1000 of 128KB writes on the SSD. This may explain why there were spikes in service time and the reduced write throughput.
In conclusion, dedup on an SSD is also very demanding as there are mixed workload of reads and writes of different sizes.


----------

