【FreeBSD】磁盘速度测试

Posted by 西维蜀黍 on 2021-05-13, Last Modified on 2024-05-07

geom - List Disks

# List all disks
$ geom disk list

# List a specific disk
$ geom disk list ada5
$ geom disk list ada2

diskinfo

-v - Descriptive Comment

  • Print fields one per line with a descriptive comment.
$ diskinfo -v nvd0
nvd0
	512         	# sectorsize
	2048408248320	# mediasize in bytes (1.9T)
	4000797360  	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	HS-SSD-C2000Pro 2048G	# Disk descr.
	30027331913 	# Disk ident.
	Yes         	# TRIM/UNMAP support
	0           	# Rotation rate in RPM

-t - Maximum Speeds

  • Give an idea of maximum speeds:
$ iskinfo -tv nvd0
nvd0
	512         	# sectorsize
	2048408248320	# mediasize in bytes (1.9T)
	4000797360  	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	HS-SSD-C2000Pro 2048G	# Disk descr.
	30027331913 	# Disk ident.
	Yes         	# TRIM/UNMAP support
	0           	# Rotation rate in RPM

Seek times:
	Full stroke:	  250 iter in   0.005332 sec =    0.021 msec
	Half stroke:	  250 iter in   0.003290 sec =    0.013 msec
	Quarter stroke:	  500 iter in   0.005623 sec =    0.011 msec
	Short forward:	  400 iter in   0.004812 sec =    0.012 msec
	Short backward:	  400 iter in   0.004696 sec =    0.012 msec
	Seq outer:	 2048 iter in   0.023893 sec =    0.012 msec
	Seq inner:	 2048 iter in   0.025834 sec =    0.013 msec

Transfer rates:
	outside:       102400 kbytes in   0.039945 sec =  2563525 kbytes/sec
	middle:        102400 kbytes in   0.035913 sec =  2851335 kbytes/sec
	inside:        102400 kbytes in   0.139413 sec =   734508 kbytes/sec

-c - Simple Measurement of the I/O Read Command Overhead - 没什么用

  • Perform a simple measurement of the I/O read command overhead.
$ iskinfo -c nvd0
nvd0
	512         	# sectorsize
	2048408248320	# mediasize in bytes (1.9T)
	4000797360  	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	HS-SSD-C2000Pro 2048G	# Disk descr.
	30027331913 	# Disk ident.
	Yes         	# TRIM/UNMAP support
	0           	# Rotation rate in RPM

I/O command overhead:
	time to read 10MB block      0.006366 sec	=    0.000 msec/sector
	time to read 20480 sectors   1.391478 sec	=    0.068 msec/sector
	calculated command overhead			=    0.068 msec/sector

-i - Simple IOPS benchmark

  • Perform a simple IOPS benchmark.
$ diskinfo -i nvd0
nvd0
	512         	# sectorsize
	2048408248320	# mediasize in bytes (1.9T)
	4000797360  	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	HS-SSD-C2000Pro 2048G	# Disk descr.
	30027331913 	# Disk ident.
	Yes         	# TRIM/UNMAP support
	0           	# Rotation rate in RPM

Asynchronous random reads:
	sectorsize:    631442 ops in    3.002054 sec =   210337 IOPS
	4 kbytes:      817982 ops in    3.000898 sec =   272579 IOPS
	32 kbytes:     236059 ops in    3.001345 sec =    78651 IOPS
	128 kbytes:     59674 ops in    3.006228 sec =    19850 IOPS

dd

# 1KB
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1024 count=1000000

# 1MB
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=1000000

bonnie++

Bonnie++ is a benchmark suite that is aimed at performing a number of simple tests of hard drive and file system performance. Then you can decide which test is important and decide how to compare different systems after running it. I have no plans to ever have it produce a single number, because I don’t think that a single number can be useful when comparing such things.

$ pkg install bonnie++
$ bonnie++ -d [TEST_LOCATION] -s [TEST_SIZE] -n 0 -m [TEST_NAME] -f -b -u [TEST_USER]

# For example:
$ bonnie++ -d /tmp -s 4G -n 0 -m TEST -f -b -u james
  • -d – is used to specify the file system directory to use to benchmark.
  • -u – is used to run a a particular user. This is best used if you run the program as root. This is the UID or the name.
  • -g – is used to run as a particular group. This is the GID or the name.
  • -r – is used to specify the amount of RAM in MB the system has installed. This is total RAM, and not free RAM. Use free -m to find out how much RAM is on your system.
  • -b – removes write buffering and performs a sync at the end of each bonnie++ operation.
  • -s – specifies the dataset size to use for the IO test in MB.
  • -n – is the number of files to use for the create files test.
  • -m – this adds a label to the output so that you can understand what the test was at a later date.
  • -x n – is used to repeat the tests n times. Change n to the number of how many times to run the tests.

Reference