The Test: Comparing /dev/random speed on Linux and BSD

Date: January 6, 2012

IBM ThinkPad (1.8GHz)
DragonFlyrandom129770365bytes/sec
urandom79501725bytes/sec
OpenBSDrandom92374770bytes/sec
FreeBSDrandom35212262bytes/sec
Debianurandom3576499bytes/sec
NetBSDurandom1379969bytes/sec
Single-core Dell OptiPlex (2.54GHz)
DragonFlyrandom160196377bytes/sec
urandom81261656bytes/sec
OpenBSDrandom150056320bytes/sec
FreeBSDrandom29790795bytes/sec
Debianurandom2388368bytes/sec
NetBSDurandom941130bytes/sec
Gateway Solo laptop (600MHz)
DragonFlyrandom39643501bytes/sec
urandom20024305bytes/sec
OpenBSDrandom28902905bytes/sec
FreeBSDrandom10608869bytes/sec
Debianurandom1002416bytes/sec
NetBSDurandom421040bytes/sec

Operating systems tested:

Methodology: I downloaded and burned ISO installation images for DragonFly, FreeBSD, Debian, and NetBSD, and used my existing (official release) OpenBSD CDs to perform fresh, bare-metal installs on three different computers: a 1.8GHz IBM ThinkPad, a 2.54GHz Dell OptiPlex, and a 600MHz Gateway Solo. No VMs were used, and default installation parameters were accepted. (Only non-default choice: The UFS filesystem was chosen over HAMMER on DragonFly, given the small disks of the test machines.) I rebooted each machine after installation, logged in, and ran dd if=/dev/random bs=32k of=/dev/null, experimenting with different blocksize values before picking the fastest in each case. I then ran dd, using the count parameter in conjunction with the blocksize to write an equal number of bytes for each OS to /dev/null, thereby getting the purest numbers on /dev/random device speed. /dev/random speed comparison
of BSD and Linux

Discussion: DragonFly has the highest /dev/random performance with OpenBSD following close behind. The /dev/random devices on DragonFly and OpenBSD are so fast that when wiping drives on these test machines, /dev/zero would not offer a performance improvement over /dev/random, as the disk itself is the limiting factor.

Please note that: