# ZFS read and write test



## sloop (Jun 22, 2011)

I am setting up a FreeBSD server for NAS use, and using a RAIDZ pool.  Using 8.2-RELEASE amd64. I did some tests with dd and the write performance is good, however the read performance is horrible:


```
homenas# dd if=/dev/zero of=foo bs=2M count=1000 ; dd if=foo of=/dev/null bs=2M
1000+0 records in
1000+0 records out
2097152000 bytes transferred in 19.079000 secs (109919388 bytes/sec)
1000+0 records in
1000+0 records out
2097152000 bytes transferred in 47.588970 secs (44068027 bytes/sec)
```

Write is 109MB/sec, while read is only 44MB/sec.  What gives?  Can the /dev/null device be broken in some way?

The only settings I have set are:


```
homenas# cat /boot/loader.conf
vm.kmem_size="1024M"
vm.kmem_size_max="1024M"
```

Hardware configuration:


```
CPU: Intel(R) Pentium(R) Dual  CPU  E2180  @ 2.00GHz (2000.01-MHz K8-class CPU)
real memory  = 2147483648 (2048 MB)
```


----------



## AndyUKG (Jun 22, 2011)

Hi,

/dev/zero will give unrealistic results if you are using compression. Also try not running the write and read back to back as ZFS will continue writing data to disk after write operations return complete. I.e.:

[cmd=]dd if=/dev/zero of=foo bs=2M count=1000 ; sleep 30 ; dd if=foo of=/dev/null bs=2M[/cmd]

cheers Andy.


----------

